Skip to content

Repository files navigation

delegate

Low-level event delegation component.

Installation

$ component install component/delegate

Example

vardelegate=require('delegate');varul=document.querySelector('ul');varn=0;varfn=delegate.bind(ul,'li a','click',function(e){console.log(e.target);console.log(e.delegateTarget);// => "<a>"if(++n==3){console.log('unbind');delegate.unbind(ul,'click',fn,false);}},false);

API

.bind(el, selector, type, callback, [capture])

Bind and return a callback which may be passed to .unbind().

.unbind(el, type, callback, [capture])

Unbind.

License

MIT

About

Event delegation component

Resources

Stars

35 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages