You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,23 @@
1
1
# loading="lazy" attribute polyfill with Service Worker
2
2
3
-
Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy loading / the awesome loading='lazy'-attribute, depending on Service Worker (kudos for that [great idea](https://github.com/mfranzke/loading-attribute-polyfill/issues/88#issuecomment-649723103) to [@garygreen](https://github.com/garygreen) !!!)
[](https://david-dm.org/mfranzke/loading-attribute-polyfill-with-serviceworker"loading-attribute polyfill – on david-dm")
10
+
[](https://npmjs.com/package/loading-attribute-polyfill-with-serviceworker'loading="lazy"-attribute polyfill – on NPM')
[](https://gitter.im/loading-attribute-polyfill-with-serviceworker/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy loading / the awesome loading='lazy'-attribute, depending on Service Worker (kudos for that [great idea](https://github.com/mfranzke/loading-attribute-polyfill/issues/88#issuecomment-649723103) to [@garygreen](https://github.com/garygreen) !!!)
20
+
15
21
- Released under the MIT license
16
22
- Made in Germany. And supported by so many great people from all over this planet - see "Credits" accordingly.
17
23
- Compatible [down to Microsoft Internet Explorer 17](https://caniuse.com/?search=serviceworker)
@@ -22,6 +28,9 @@ Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy
22
28
- Web standards: supports the standard `loading="lazy"` attribute on `img` and `iframe` elements
23
29
- Performance: it's based on highly efficient, best practice code.
24
30
- SEO & crawlers: the image and iframe contents aren't being hidden from crawlers that aren't capable of scrolling.
31
+
- JavaScript framework friendly\*
32
+
33
+
\*As some JavaScript frameworks would like to "own the DOM", it's not a good practice to try to manipulate the HTML content by our polyfill. That for this solution hooks into the network connection (by a Service Worker that you would need to register) to intercept the image and iframe contents requests.
25
34
26
35
## Core concepts
27
36
@@ -51,7 +60,7 @@ Include one of the provided JavaScript files depending on your setup plus the CS
0 commit comments