3 ms·
You can, of course, make it more robust, like: function $$(sel, parent) { var nodes = (parent || document).querySelectorAll(sel); return Array.protot
by tyingq 6y ago
You can, of course, make it more robust, like:
function $$(sel, parent) {
var nodes = (parent || document).querySelectorAll(sel);
return Array.prototype.slice.call(nodes, 0);
}
Similarly, you can get rid of $$ and fold it all into $, etc. I was trying to be concise in the original response.
- arp242 6y agoYeah, but 19 helper functions later and you've got half of jQuery. I'd rather use a properly tested library.