-
-
Save AshikNesin/d3f558375736ca9175c627d9a2f09dd7 to your computer and use it in GitHub Desktop.
This file contains 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
// based on https://gist.github.com/Potfur/5576225 & https://github.com/james2doyle/saltjs | |
// more info: https://plus.google.com/109231487156400680487/posts/63eZzzrBSb6 | |
window.$ = function(s) { | |
var c = { | |
'#': 'ById', | |
'.': 'sByClassName', | |
'@': 'sByName', | |
'=': 'sByTagName'}[s[0]]; | |
return document[c?'getElement'+c:'querySelectorAll'](s.slice(1)) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment