2 ms·
The author should test their own examples var $ = document.querySelectorAll; That doesn't work, it throws `TypeError: 'querySelectorAll' called on an obje
by DiThi 12y ago
The author should test their own examples
var $ = document.querySelectorAll;
That doesn't work, it throws `TypeError: 'querySelectorAll' called on an object that does not implement interface Document.` The correct line is:
var $ = document.querySelectorAll.bind(document);
I know this well because I use it in all my JS projects and plays nicely with Python style for loops (e.g. in CoffeeScript).
While I avoid jQuery I awknowledge the value of it, esp with old and mobile browsers. I avoid it precisely because my apps need modern HTML5/WebGL capable browsers anyway.