0.0.5 • Published 7 years ago
@readable/delegate v0.0.5
Delegate
Simple and fast vanilla js event delegation. Uses Element.closest
and falls back on @readable/closest fast polyfill. In case better browser support is needed, use slower and more primitive Element.closest
polyfill.
Element.closest
polyfill is required only for IE, other reasonably up to date browsers are fine without it.
Install
npm install --save @readable/delegate
<script src="node_modules/@readable/closest/closest.js"></script>
<script src="node_modules/@readable/delegate/delegate.js"></script>
Example
Rd.delegateEvent(document, 'click', '#counter', function (event) {
this.innerText += 1
})
<button id="counter">0</button>