[lozad] update tests for version 1.2

This commit is contained in:
Taras Rodynenko
2019-01-15 10:43:12 +02:00
parent 434d0990a5
commit 6eb71f60b3
+15
View File
@@ -8,6 +8,21 @@ const observer = lozad('.lozad', {
// Custom implementation to load an element
// e.g. el.src = el.dataset.src;
},
loaded(el) {
console.log('loaded element');
}
});
observer.observe();
const singleElement = document.getElementById('hello');
if (singleElement) {
const observer2 = lozad(singleElement);
observer2.triggerLoad(singleElement);
}
const elementsCollection = document.getElementsByClassName('lozad');
if (elementsCollection) lozad(elementsCollection);
const nodeList = document.querySelectorAll('.images');
if (nodeList) lozad(nodeList);