Reading through some js-files loaded in the background of a site, I came across this construct:
var foo = (document.querySelector(".some-selector"),
document.querySelectorAll(".some-selector > ul > li"));
Array.prototype.forEach.call(foo, ...);
The call to querySelector()
seems obsolete, but going by the code and the source of this script, I don't get the feeling that this was a mistake, or that they meant [...]
instead of (...)
. The code was minified, but not obfuscated; to me this seems intentionally, but I don't get the point.
My best guesses are that either, the call to querySelector()
somehow speeds up the subsequent call to querySelectorAll()
or that this is some kind of browser hack. But I could not find anything related to this construct yet.
Does anyone here know what this is about, or point me in the right direction?