Skip to content

Commit f83b535

Browse files
author
Andrea Verlicchi
committed
Merge branch 'release/15.2.0'
2 parents 12c5005 + 75b0e09 commit f83b535

34 files changed

+1799
-484
lines changed

CHANGELOG.md

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

33
## Version 15
44

5+
#### 15.2.0
6+
7+
OPTIMIZE FOR SLOW CONNECTIONS WITH `cancel_on_exit`
8+
9+
Want to optimize speed for users who scroll down fast on a slow connection? Just set `cancel_on_exit: true` and LazyLoad will cancel the download of images exiting the viewport while still loading, eventually restoring the original attributes.
10+
11+
- Introduced the new `cancel_on_exit` option.
12+
- Introduced the `callback_cancel` option, just in case you want to perform any additional action whenever a download gets canceled by `cancel_on_exit`.
13+
- Created a new demo named `cancel_on_exit.html` so you can try the new `cancel_on_exit` option live.
14+
- Set `cancel_on_exit` to `true` in the following demos, so you can test how it behaves...
15+
- `image_ph_inline.html`, with an inline SVG placeholder
16+
- `image_ph_external.html`, with an external SVG placeholder
17+
- `delay_test.html`, in conjuction with the `delay_load` option
18+
- `fade_in.html`, with a beautiful fade-in effect.
19+
20+
The `cancel_on_exit` option applies only to images so to the `img` (and `picture`) tags. It doesn't work for background images, `iframe`s nor `video`s.
21+
22+
The `cancel_on_exit` option will probably default to `true` starting from the next major version, so give it a try! And please report your feedback in the comments of [#438](https://github.com/verlok/lazyload/issues/438).
23+
24+
API
25+
26+
- Added the `resetElementStatus()` method for when you need to tell LazyLoad to consider an image (or other DOM element) again. This is particularly useful if you change the `data-src` attribute after the previous `data-src` was loaded). See the [API section](README.md#-api) in the README file for more information.
27+
28+
FIX
29+
30+
- The `callback_exit` callback was called several times (for every images out of the viewport) at instance creation or upon `update()` calls. Now the callback is properly called only when any element exits the viewport.
31+
32+
INTERNALS
33+
34+
- Improved script performance by reducing the number of event listeners used for loading elements.
35+
- Changed the values that the (internally used) `data-ll-status` attribute can take. Removed the status `"observed"` (it was useless) and introduced status `"delayed"`.
36+
537
#### 15.1.1
638

739
Fixed a bug when loading lazy background images on HiDPI screens, `data-bg-hidpi` was mandatory, not it fallbacks to `data-bg`. #430

README.md

Lines changed: 47 additions & 18 deletions
Large diffs are not rendered by default.

currentFeature.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Current feature: resetElement
2+
3+
It all started with #438.
4+
5+
1. Ability to reset an element status via `resetElementStatus`, in case you need it
6+
(e.g. some users want to change the `data-src` and make LazyLoad reconsider those images)
7+
2. Introduced a new option `cancel_on_exit` to cancel the download of the exiting images(\*) and restore the original sources (placeholders)
8+
3. Introduced the new `callback_cancel` option, it will be called whenever a download gets canceled
9+
4. Created a new demo named `cancel_on_exit.html`
10+
5. Set the `cancel_on_exit: true` in new demos for cross feature testing
11+
- `image_ph_inline.html`,
12+
- `image_ph_external.html`,
13+
- `delay_test.html`
14+
- `fade_in.html`
15+
6. Better event listeners management and removal (event listeners are temporarily stored inside the DOM elements).
16+
7. Removed status `"observed"` (it was useless), introduced status `"delayed"` to distinguish exit at landing | exit after delay.
17+
18+
(\*) this technique doesn't work on `iframe` and `video` and it's too complex to manage for background images, it's now restricted only to `img` (and `picture`) tags.
19+
20+
---
21+
22+
Solved issues:
23+
24+
- The count loading / to load elements works now.
25+
- The `isElementLoading` is not exposed anymore.
26+
- DOM elements are unobserved when loaded / when start loading (multiple backgrounds)
27+
- Canceling the download no longer triggers `callback_error`
28+
- Restored `delay_load` functionality

0 commit comments

Comments
 (0)