Created
November 18, 2019 15:25
-
-
Save pinkhominid/b930061aa99eb996e7191534eeaebf5a to your computer and use it in GitHub Desktop.
Short-hand querySelector/querySelectorAll
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
// Found in a Lea Verou project and tweaked :) (https://github.com/LeaVerou/animatable/blob/gh-pages/index.js#L1) | |
function $(expr, con) { return (con || document).querySelector(expr); } | |
function $$(expr, con) { return Array.from((con || document).querySelectorAll(expr)); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment