Because you want the $ of jQuery without the jQuery.
-
-
Save abhijithvijayan/99b72cef2d9f0acb365dca1a8e239998 to your computer and use it in GitHub Desktop.
bling dot js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* bling.js */ | |
const $ = document.querySelector.bind(document); | |
const $$ = 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); | |
}); | |
} | |
export { $, $$ }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment