1
0
Эх сурвалжийг харах

don't override Element#getBoundingClientRect with undefined

Gildas 7 жил өмнө
parent
commit
0fe9a1f0e4

+ 6 - 4
lib/lazy/web-lazy-loader-after.js

@@ -22,9 +22,11 @@
 
 (() => {
 
-	Element.prototype.getBoundingClientRect = window._singleFile_getBoundingClientRect;
-	delete window._singleFile_getBoundingClientRect;
-	scrollBy(0, 1);
-	requestAnimationFrame(() => scrollBy(0, -1));
+	if (window._singleFile_getBoundingClientRect) {
+		Element.prototype.getBoundingClientRect = window._singleFile_getBoundingClientRect;
+		delete window._singleFile_getBoundingClientRect;
+		scrollBy(0, 1);
+		requestAnimationFrame(() => scrollBy(0, -1));
+	}
 
 })();