我检查从HTML5ROCKS验证码: http://www.html5rocks.com/static/demos/parallax/demo-1a/scripts/parallax.jsdocument.querySelector.bind(document)是什么意思;
,并注意到他们使用
(function(win, d) {
var $ = d.querySelector.bind(d);
....
var mainBG = $('section#content');
....
})(window, document);
为什么它们连接的文件到querySelector。它不是已经限定在文档中吗?
[本答案](http://stackoverflow.com/questions/13383886/making-a-short-alias-for-document-queryselectorall)具有进一步的解释。简短回答:JavaScript解释器抛出错误,因为应在文档上下文中调用querySelectorAll()。 –