나는 HTML5ROCKS에서이 코드를 확인했다 : http://www.html5rocks.com/static/demos/parallax/demo-1a/scripts/parallax.jsdocument.querySelector.bind (document)의 의미는 무엇입니까?
을 그리고 그들이 querySelector에 문서를 제본 그들은 왜
(function(win, d) {
var $ = d.querySelector.bind(d);
....
var mainBG = $('section#content');
....
})(window, document);
를 사용하는 것을 알 수 있습니다. 이미 문서에 범위가 설정되어 있지 않습니까?
[이 답변] (http://stackoverflow.com/questions/13383886/making-a-short-alias-for-document-queryselectorall) 자세한 설명이 있습니다. 짧은 대답 : querySelectorAll()이 문서 컨텍스트에서 호출되어야하므로 JavaScript 인터프리터에서 오류가 발생합니다. –