Skip to content

Instantly share code, notes, and snippets.

@fwon
Created June 15, 2015 03:29
Show Gist options
  • Save fwon/66840a283e2da31d0e96 to your computer and use it in GitHub Desktop.
Save fwon/66840a283e2da31d0e96 to your computer and use it in GitHub Desktop.
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype
NodeList.prototype.on = NodeList.prototype.addEventListener = function (name, fn) {
this.forEach(function (elem, i) {
elem.on(name, fn)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment