Skip to content

Commit

Permalink
Merge branch 'release/17.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
verlok committed May 30, 2021
2 parents 88c7f82 + 7c04765 commit 4426bae
Show file tree
Hide file tree
Showing 15 changed files with 3,615 additions and 3,354 deletions.
14 changes: 7 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"ignore": ["node_modules/**"],
"plugins": ["@babel/plugin-transform-object-assign"],
"presets": [["@babel/env", { "modules": false }]],
"env": {
"test": {
"presets": ["@babel/preset-env"]
}
"ignore": ["node_modules/**"],
"plugins": ["@babel/plugin-transform-object-assign"],
"presets": [["@babel/env", { "modules": false }]],
"env": {
"test": {
"presets": ["@babel/preset-env"]
}
}
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Version 17

#### 17.3.2

- Fixes double trigger of `callback_load` after a watched image was loaded using the static `load()` method (#526). Thanks to @nick-vincent.

#### 17.3.1

- Removed `caniuse-lite` from dependencies. Fixes #505. Thanks to @ar53n.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Please note that the video poster can be lazily loaded too.

## 👩‍💻 Getting started - Script

The latest, recommended version of LazyLoad is **17.3.1**.
The latest, recommended version of LazyLoad is **17.3.2**.

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

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

```html
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.2/dist/lazyload.min.js"></script>
```

Or, with the IntersectionObserver polyfill:

```html
<script src="https://cdn.jsdelivr.net/npm/intersection-observer@0.7.0/intersection-observer.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.2/dist/lazyload.min.js"></script>
```

Then, in your javascript code:
Expand Down Expand Up @@ -209,7 +209,7 @@ Include RequireJS:
Then `require` the AMD version of LazyLoad, like this:

```js
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.amd.min.js";
var lazyLoadAmdUrl = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.2/dist/lazyload.amd.min.js";
var polyfillAmdUrl = "https://cdn.jsdelivr.net/npm/intersection-observer-amd@2.0.1/intersection-observer-amd.js";

/// Dynamically define the dependencies
Expand Down Expand Up @@ -254,7 +254,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.2/dist/lazyload.min.js"
></script>
```
Expand Down Expand Up @@ -288,7 +288,7 @@ Then include the script.
```html
<script
async
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.1/dist/lazyload.min.js"
src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.3.2/dist/lazyload.min.js"
></script>
```
Expand Down
7 changes: 5 additions & 2 deletions dist/lazyload.amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,16 @@ define(function () { 'use strict';
};

var onEnter = function onEnter(element, entry, settings, instance) {
var dontLoad = hadStartedLoading(element);
/* Save status
before setting it, to prevent loading it again. Fixes #526. */

setStatus(element, statusEntered);
addClass(element, settings.class_entered);
removeClass(element, settings.class_exited);
unobserveEntered(element, settings, instance);
safeCallback(settings.callback_enter, element, entry, instance);
if (hadStartedLoading(element)) return; //Prevent loading it again

if (dontLoad) return;
load(element, settings, instance);
};
var onExit = function onExit(element, entry, settings, instance) {
Expand Down
2 changes: 1 addition & 1 deletion dist/lazyload.amd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/lazyload.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,14 @@ const cancelLoading = (element, entry, settings, instance) => {
};

const onEnter = (element, entry, settings, instance) => {
const dontLoad = hadStartedLoading(element); /* Save status
before setting it, to prevent loading it again. Fixes #526. */
setStatus(element, statusEntered);
addClass(element, settings.class_entered);
removeClass(element, settings.class_exited);
unobserveEntered(element, settings, instance);
safeCallback(settings.callback_enter, element, entry, instance);
if (hadStartedLoading(element)) return; //Prevent loading it again
if (dontLoad) return;
load(element, settings, instance);
};

Expand Down
Loading

0 comments on commit 4426bae

Please sign in to comment.