It bugs me that I can\'t just do document.querySelectorAll(...).map(...) even in Firefox 3.6, and I still can\'t find an answer, so I thought I\'d cross-post on
This is an option I wanted to add to the range of other possibilities suggested by others here. It's meant for intellectual fun only and is not advised.
Just for the fun of it, here's a way to "force" querySelectorAll to kneel down and bow to you:
Element.prototype.querySelectorAll = (function(QSA){
return function(){
return [...QSA.call(this, arguments[0])]
}
})(Element.prototype.querySelectorAll);
Now it feels good to step all over that function, showing it who's the boss.
Now I don't know what's better, creating a whole new named function wrapper and then have all your code use that weird name (pretty much jQuery-style) or override the function like above once so the rest of your code would still be able to use the original DOM method name querySelectorAll.
I wouldn't recommend this in any way, unless you honestly don't give a [you know what].