Explorar o código

don't override Element#getBoundingClientRect with undefined

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
0fe9a1f0e4
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      lib/lazy/web-lazy-loader-after.js

+ 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));
+	}
 
 })();