Skip to content

Commit 8d101ae

Browse files
committed
Merge branch 'release/17.2.0'
2 parents ef3288a + a9c4458 commit 8d101ae

18 files changed

+105
-325
lines changed

.prettierrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"printWidth": 100,
5+
"trailingComma": "none",
6+
"overrides": [
7+
{
8+
"files": "*.js",
9+
"options": {
10+
"tabWidth": 4
11+
}
12+
}
13+
]
14+
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Version 17
44

5+
#### 17.2.0
6+
7+
- Rolling back the "`data` attribute cleanup" feature that was released on 16.1.0 and was causing issues like [#484](https://github.com/verlok/vanilla-lazyload/issues/484) when more than one instance of LazyLoad were working on the same elements of the page - the script is also 500 bytes lighter now
8+
59
#### 17.1.3
610

711
- Added missing types (#480), thanks to @ar53n (#482)

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Please note that the video poster can be lazily loaded too.
190190

191191
## 👩‍💻 Getting started - Script
192192

193-
The latest, recommended version of LazyLoad is **17.1.3**.
193+
The latest, recommended version of LazyLoad is **17.2.0**.
194194

195195
Quickly understand how to upgrade from a previous version reading the [practical upgrade guide](UPGRADE.md).
196196

@@ -207,14 +207,14 @@ If you prefer to load a polyfill, the regular LazyLoad behaviour is granted.
207207
The easiest way to use LazyLoad is to include the script from a CDN:
208208

209209
```html
210-
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.3/dist/lazyload.min.js"></script>
210+
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.2.0/dist/lazyload.min.js"></script>
211211
```
212212

213213
Or, with the IntersectionObserver polyfill:
214214

215215
```html
216216
<script src="https://cdn.jsdelivr.net/npm/[email protected]/intersection-observer.js"></script>
217-
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.3/dist/lazyload.min.js"></script>
217+
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.2.0/dist/lazyload.min.js"></script>
218218
```
219219

220220
Then, in your javascript code:
@@ -246,7 +246,7 @@ Include RequireJS:
246246
Then `require` the AMD version of LazyLoad, like this:
247247

248248
```js
249-
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.3/dist/lazyload.amd.min.js";
249+
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.2.0/dist/lazyload.amd.min.js";
250250
var polyfillAmdUrl = "https://cdn.jsdelivr.net/npm/[email protected]/intersection-observer-amd.js";
251251

252252
/// Dynamically define the dependencies
@@ -291,7 +291,7 @@ Then include the script.
291291
```html
292292
<script
293293
async
294-
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.3/dist/lazyload.min.js"
294+
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.2.0/dist/lazyload.min.js"
295295
></script>
296296
```
297297
@@ -325,7 +325,7 @@ Then include the script.
325325
```html
326326
<script
327327
async
328-
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.3/dist/lazyload.min.js"
328+
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.2.0/dist/lazyload.min.js"
329329
></script>
330330
```
331331

dist/lazyload.amd.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ define(function () { 'use strict';
367367
var manageApplied = function manageApplied(element, settings, instance) {
368368
addClass(element, settings.class_applied);
369369
setStatus(element, statusApplied);
370-
removeDataMultiBackground(element, settings);
371370

372371
if (settings.unobserve_completed) {
373372
// Unobserve now because we can't do it on load
@@ -381,49 +380,6 @@ define(function () { 'use strict';
381380
addClass(element, settings.class_loading);
382381
setStatus(element, statusLoading);
383382
safeCallback(settings.callback_loading, element, instance);
384-
}; // REMOVE DATA ATTRIBUTES --------------
385-
386-
var removeDataImg = function removeDataImg(element, settings) {
387-
setData(element, settings.data_src, null);
388-
setData(element, settings.data_srcset, null);
389-
setData(element, settings.data_sizes, null);
390-
forEachPictureSource(element, function (sourceTag) {
391-
setData(sourceTag, settings.data_srcset, null);
392-
setData(sourceTag, settings.data_sizes, null);
393-
});
394-
};
395-
var removeDataIframe = function removeDataIframe(element, settings) {
396-
setData(element, settings.data_src, null);
397-
};
398-
var removeDataVideo = function removeDataVideo(element, settings) {
399-
setData(element, settings.data_src, null);
400-
setData(element, settings.data_poster, null);
401-
forEachVideoSource(element, function (sourceTag) {
402-
setData(sourceTag, settings.data_src, null);
403-
});
404-
};
405-
var removeDataFunctions = {
406-
IMG: removeDataImg,
407-
IFRAME: removeDataIframe,
408-
VIDEO: removeDataVideo
409-
};
410-
var removeDataBackground = function removeDataBackground(element, settings) {
411-
setData(element, settings.data_bg, null);
412-
setData(element, settings.data_bg_hidpi, null);
413-
};
414-
var removeDataMultiBackground = function removeDataMultiBackground(element, settings) {
415-
setData(element, settings.data_bg_multi, null);
416-
setData(element, settings.data_bg_multi_hidpi, null);
417-
};
418-
var removeDataAttributes = function removeDataAttributes(element, settings) {
419-
var removeDataFunction = removeDataFunctions[element.tagName];
420-
421-
if (removeDataFunction) {
422-
removeDataFunction(element, settings);
423-
return;
424-
}
425-
426-
removeDataBackground(element, settings);
427383
};
428384

429385
var elementsWithLoadEvent = ["IMG", "IFRAME", "VIDEO"];
@@ -480,7 +436,6 @@ define(function () { 'use strict';
480436
doneHandler(element, settings, instance);
481437
addClass(element, settings.class_loaded);
482438
setStatus(element, statusLoaded);
483-
removeDataAttributes(element, settings);
484439
safeCallback(settings.callback_loaded, element, instance);
485440
if (!goingNative) checkFinish(settings, instance);
486441
};
@@ -536,7 +491,6 @@ define(function () { 'use strict';
536491
var loadNative = function loadNative(element, settings, instance) {
537492
addOneShotEventListeners(element, settings, instance);
538493
setSources(element, settings);
539-
removeDataAttributes(element, settings);
540494
setStatus(element, statusNative);
541495
};
542496

0 commit comments

Comments
 (0)