Authored by 毕凯

选择器优化

... ... @@ -39,7 +39,7 @@ var t = setInterval(function() {
clearInterval(t);
}
} else {
var imgs = document.body.querySelector('img') || [];
var imgs = document.body && document.body.querySelectorAll('img') || [];
for (i = 0; i < imgs.length; i++) {
img = imgs[i];
var imgOffsetTop = getOffsetTop(img);
... ... @@ -81,7 +81,7 @@ var speedReporter = {
});
// 首屏加载速度
var imgs = document.body.querySelector('img') || [];
var imgs = document.body && document.body.querySelectorAll('img') || [];
if (!imgs.length) {
isFindLastImg = true;
}
... ...