Skip to content

Commit fce352f

Browse files
committed
improvement(export): export function to processed DOM loaded after DOM ready
1 parent a21b7d5 commit fce352f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

loading-attribute-polyfill.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Use an IntersectionObserver polyfill in case of IE11 support necessary.
1111
*/
1212

13-
(function (noscriptClass, rootMargin) {
13+
const lazyload = function (noscriptClass = 'loading-lazy', rootMargin = '256px 0px') {
1414
'use strict';
1515

1616
var config = {
@@ -236,7 +236,9 @@
236236
*/
237237
function prepareElements() {
238238
//
239-
var lazyLoadAreas = document.querySelectorAll('noscript.' + noscriptClass);
239+
var lazyLoadAreas = document.querySelectorAll(
240+
'noscript.' + config.noscriptClass
241+
);
240242

241243
lazyLoadAreas.forEach(prepareElement);
242244

@@ -260,4 +262,8 @@
260262
}
261263
});
262264
}
263-
})('loading-lazy', '256px 0px');
265+
};
266+
267+
lazyload();
268+
269+
export default lazyload;

0 commit comments

Comments
 (0)