4 ms·
I like the fact that it works with querySelectorAll! This is compatible with my projects in which I do: var qsa = function(sel){return document.querySelect
by antoineMoPa 10y ago
I like the fact that it works with querySelectorAll! This is compatible with my projects in which I do:
var qsa = function(sel){return document.querySelectorAll(sel)};
However, it does not work with:
var subqsa = function(el,sel){return el.querySelectorAll(sel);}
- maga 10y agoIf you're seriously wondering why is it so then, well, they're just replacing native methods of the document object, in order to get the same behavior from your second line, they'll have to replace Element.prototype.querySelectorAll as well, which is a bad idea.
- nailer 10y agoYou can just: var queryAll = document.querySelectorAll.bind(document);