1
我想了解queryselectorall的这个polyfill? Specifially这一行:这个polyfill如何为document.queryselectorall工作?
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
https://gist.github.com/connrs/2724353
if (!document.querySelectorAll) {
document.querySelectorAll = function(selector) {
var doc = document,
head = doc.documentElement.firstChild,
styleTag = doc.createElement('STYLE');
head.appendChild(styleTag);
doc.__qsaels = [];
styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}";
window.scrollBy(0, 0);
return doc.__qsaels;
}
}
这条线是CSS-表达,填补阵列'DOC .__ qsaels' – Grundy 2014-08-31 17:46:38