Skip to content

ralt/delegation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

delegation

Purpose

Implements event delegation.

Example

var delegate = require('delegation');

delegate(document, 'click', 'li', function(e) {
    console.log(this.nodeName); // "LI"
});

API

The module returns a function with four arguments:

  • parent: the parent on which to listen for the event
  • event: the event to listen to
  • selector: the selector for the elements to delegate to
  • handler: the event handler

Installation

npm install delegation

Contributors

License

MIT License.

About

Implements event delegation.

Resources

Stars

Watchers

Forks

Packages

No packages published