|
|
@@ -66,6 +66,7 @@ this.singlefile.lib.processors.lazy.content.loader = this.singlefile.lib.process
|
|
|
const updated = mutations.filter(mutation => {
|
|
|
if (mutation.attributeName == "src") {
|
|
|
mutation.target.setAttribute(singlefile.lib.helper.LAZY_SRC_ATTRIBUTE_NAME, mutation.target.src);
|
|
|
+ mutation.target.addEventListener("load", onResourceLoad);
|
|
|
}
|
|
|
if (mutation.attributeName == "src" || mutation.attributeName == "srcset" || mutation.target.tagName == "SOURCE") {
|
|
|
return mutation.target.className != SINGLE_FILE_UI_ELEMENT_CLASS;
|
|
|
@@ -94,6 +95,12 @@ this.singlefile.lib.processors.lazy.content.loader = this.singlefile.lib.process
|
|
|
frames.loadDeferredImagesStart(options);
|
|
|
}
|
|
|
|
|
|
+ function onResourceLoad(event) {
|
|
|
+ const element = event.target;
|
|
|
+ element.removeAttribute(singlefile.lib.helper.LAZY_SRC_ATTRIBUTE_NAME);
|
|
|
+ element.removeEventListener(onResourceLoad);
|
|
|
+ }
|
|
|
+
|
|
|
async function onImageLoadEvent(event) {
|
|
|
loadingImages = true;
|
|
|
maxTimeoutId = await deferForceLazyLoadEnd(timeoutId, idleTimeoutId, maxTimeoutId, observer, options, cleanupAndResolve);
|