delegate
Lightweight event delegation.
Install
You can get it on npm.
npm install delegate --save
If you're not into package management, just download a ZIP file.
Setup
Node (Browserify)
var delegate = ;
Browser (Standalone)
Usage
Add event delegation
document
)
With the default base (;
With an element as base
;
With a selector (of existing elements) as base
;
With an array/array-like of elements as base
;
Remove event delegation
With a single base element (default or specified)
var delegation = ; delegation;
With multiple elements (via selector or array)
Note: selectors are always treated as multiple elements, even if one or none are matched. delegate()
will return an array.
var delegations = ; delegations;
Browser Support
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
Latest ✔ | Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | Latest ✔ |
License
MIT License © Zeno Rocha