Skip to content

Instantly share code, notes, and snippets.

@potfur
Last active February 15, 2023 14:49
Show Gist options
  • Save potfur/5576225 to your computer and use it in GitHub Desktop.
Save potfur/5576225 to your computer and use it in GitHub Desktop.
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