Skip to content

Instantly share code, notes, and snippets.

@smosc
smosc / $.3.js
Created August 5, 2017 16:16 — forked from ofca/$.3.js
// 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))
};

Keybase proof

I hereby claim:

  • I am smosc on github.
  • I am osc (https://keybase.io/osc) on keybase.
  • I have a public key whose fingerprint is 346B 8719 96DF 2005 6403 C325 E8D0 3587 D4F4 55C2

To claim this, I am signing this object: