forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathls.attrchange.min.js
2 lines (2 loc) · 1.63 KB
/
ls.attrchange.min.js
1
2
/*! lazysizes - v4.0.2 */
!function(a,b){var c=function(){b(a.lazySizes),a.removeEventListener("lazyunveilread",c,!0)};b=b.bind(null,a,a.document),"object"==typeof module&&module.exports?b(require("lazysizes")):a.lazySizes?c():a.addEventListener("lazyunveilread",c,!0)}(window,function(a,b,c){"use strict";if(a.addEventListener){var d=a.requestAnimationFrame||setTimeout,e=function(){var f,g,h,i,j=c.cfg,k={"data-bgset":1,"data-include":1,"data-poster":1,"data-bg":1,"data-script":1},l="(\\s|^)("+j.loadedClass,m=b.documentElement,n=function(a){d(function(){c.rC(a,j.loadedClass),j.unloadedClass&&c.rC(a,j.unloadedClass),c.aC(a,j.lazyClass)})},o=function(a){var b,c,d,e;for(b=0,c=a.length;c>b;b++)d=a[b],e=d.target,e.getAttribute(d.attributeName)&&("source"==e.localName&&e.parentNode&&(e=e.parentNode.querySelector("img")),e&&l.test(e.className)&&n(e))};j.unloadedClass&&(l+="|"+j.unloadedClass),l+="|"+j.loadingClass+")(\\s|$)",l=new RegExp(l),k[j.srcAttr]=1,k[j.srcsetAttr]=1,a.MutationObserver?(h=new MutationObserver(o),f=function(){i||(i=!0,h.observe(m,{subtree:!0,attributes:!0,attributeFilter:Object.keys(k)}))},g=function(){i&&(i=!1,h.disconnect())}):(m.addEventListener("DOMAttrModified",function(){var a,b=[],c=function(){o(b),b=[],a=!1};return function(d){i&&k[d.attrName]&&d.newValue&&(b.push({target:d.target,attributeName:d.attrName}),a||(setTimeout(c),a=!0))}}(),!0),f=function(){i=!0},g=function(){i=!1}),addEventListener("lazybeforeunveil",g,!0),addEventListener("lazybeforeunveil",f),addEventListener("lazybeforesizes",g,!0),addEventListener("lazybeforesizes",f),f(),removeEventListener("lazybeforeunveil",e)};addEventListener("lazybeforeunveil",e)}});