A homemade event delegation method for Element
interface, like jQuery's .on()
. Initially inspired and grabbed from
32bitkid's CodePen.
WARNING: This is my first Node module, like a starter savoury or a demo by myself, rather than a production package, and most importantly, it is still in progress.
Currently not uploaded on npm
$ git clone git@github.com:anqurvanillapy/selectOn.git
$ cd selectOn
$ npm install
// delegate events to all the `li`s in a `ul`
require('selectOn')
var ul = document.querySelector('ul')
ul.selectOn('click', 'li', function (e) {
console.log(e.target.textContent)
})
FIXME: selector
is currently fake, which only detects the
tagName
of target.
ISC © AnqurVanillapy