Re:Bling – the $ of jQuery without the jQuery
by zodiakzz on Monday June 15, 2015 @05:12AM
(#9718263)
I prefer:-
[ Parent
| on HN ]
Re:Bling – the $ of jQuery without the jQuery
by egeozcan on Monday June 15, 2015 @05:36AM
(#9718344)
I'd also wrap it in a `[].slice.call`:
function $(q, parent) {
parent = parent || document;
return [].slice.call(parent.querySelectorAll(q));
}
Re:Bling – the $ of jQuery without the jQuery
by marcoms on Monday June 15, 2015 @09:45AM
(#9719210)
Also see ES2015's Array.from()
Array.from(<NodeList or other iterable>)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...