Skip to content

Instantly share code, notes, and snippets.

@potfur
potfur / $.js
Last active February 15, 2023 14:49
window.S = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
};
// [S('#header'), S('.container'), S('?div')]