فهرست منبع

use attributes

Gildas 7 سال پیش
والد
کامیت
1fd5a580d5
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      lib/lazy/content-lazy-loader.js
  2. 2 2
      lib/single-file/doc-helper.js

+ 1 - 1
lib/lazy/content-lazy-loader.js

@@ -51,7 +51,7 @@ this.lazyLoader = this.lazyLoader || (() => {
 				if (mutations.length) {
 					mutations.forEach(mutation => {
 						if (mutation.target.src) {
-							mutation.target.dataset.lazySrc = mutation.target.src;
+							mutation.target.setAttribute("data-lazy-loaded-src", mutation.target.src);
 						}
 					});
 					srcAttributeChanged = true;

+ 2 - 2
lib/single-file/doc-helper.js

@@ -279,9 +279,9 @@ this.docHelper = this.docHelper || (() => {
 			doc.querySelectorAll("img").forEach((imageElement, imageElementIndex) => {
 				imageElement.setAttribute(imagesAttributeName(options.sessionId), imageElementIndex);
 				const imageData = {
-					currentSrc: (options.lazyLoadImages && imageElement.dataset.lazySrc) || imageElement.currentSrc
+					currentSrc: (options.lazyLoadImages && imageElement.getAttribute("data-lazy-loaded-src")) || imageElement.currentSrc
 				};
-				delete imageElement.dataset.lazySrc;
+				imageElement.removeAttribute("data-lazy-loaded-src");
 				const computedStyle = win.getComputedStyle(imageElement);
 				if (computedStyle) {
 					imageData.size = getSize(win, imageElement);