3 ms·
I'd also wrap it in a `[].slice.call`: function $(q, parent) { parent = parent || document; return [].slice.call(parent.querySelectorAll(q)
by egeozcan 11y ago
I'd also wrap it in a `[].slice.call`:
function $(q, parent) {
parent = parent || document;
return [].slice.call(parent.querySelectorAll(q));
}
- marcoms 11y agoAlso see ES2015's Array.from() Array.from(<NodeList or other iterable>) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...