vanilla-lazyload
Version:
LazyLoad is a lightweight (2.4 kB) and flexible script that speeds up your web application by deferring the loading of your below-the-fold images, videos and iframes to when they will enter the viewport. It's written in plain "vanilla" JavaScript, it leve
2 lines (1 loc) • 784 B
JavaScript
import{ORIGINALS as t,SRC as e,POSTER as r,SRCSET as o,SIZES as n,DATA as a}from"./constants.js";const c=[e],s=[e,r],u=[e,o,n],g=[a],b=e=>!!e[t],i=e=>e[t],m=e=>delete e[t],f=(e,r)=>{if(b(e))return;const o={};r.forEach((t=>{o[t]=e.getAttribute(t)})),e[t]=o},d=e=>{b(e)||(e[t]={backgroundImage:e.style.backgroundImage})},k=(t,e)=>{if(!b(t))return;const r=i(t);e.forEach((e=>{((t,e,r)=>{r?t.setAttribute(e,r):t.removeAttribute(e)})(t,e,r[e])}))},I=t=>{if(!b(t))return;const e=i(t);t.style.backgroundImage=e.backgroundImage};export{g as attrsData,c as attrsSrc,s as attrsSrcPoster,u as attrsSrcSrcsetSizes,m as deleteOriginalAttrs,i as getOriginalAttrs,b as hasOriginalAttrs,k as restoreOriginalAttrs,I as restoreOriginalBgImage,d as saveOriginalBackgroundStyle,f as setOriginalsObject};