Skip to content

Instantly share code, notes, and snippets.

@potfur potfur/$.js
Last active May 6, 2018

What would you like to do?
window.S = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
// [S('#header'), S('.container'), S('?div')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.