Răsfoiți Sursa

removed usage of scrollX and scrollY

Gildas 7 ani în urmă
părinte
comite
b6a0d2846b
1 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 3 3
      extension/ui/content/content-ui.js

+ 3 - 3
extension/ui/content/content-ui.js

@@ -18,7 +18,7 @@
  *   along with SingleFile.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* global browser, document, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, scrollX, scrollY, setTimeout */
+/* global browser, document, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout */
 
 this.singlefile.ui = this.singlefile.ui || (() => {
 
@@ -159,8 +159,8 @@ this.singlefile.ui = this.singlefile.ui || (() => {
 		requestAnimationFrame(() => {
 			const selectorElement = createAreaSelector();
 			const boundingRect = target.getBoundingClientRect();
-			selectorElement.style.setProperty("top", (scrollY + boundingRect.top - 10) + "px");
-			selectorElement.style.setProperty("left", (scrollX + boundingRect.left - 10) + "px");
+			selectorElement.style.setProperty("top", (document.documentElement.scrollTop + boundingRect.top - 10) + "px");
+			selectorElement.style.setProperty("left", (document.documentElement.scrollLeft + boundingRect.left - 10) + "px");
 			selectorElement.style.setProperty("width", (boundingRect.width + 20) + "px");
 			selectorElement.style.setProperty("height", (boundingRect.height + 20) + "px");
 		});