Skip to content

Commit 291b44d

Browse files
committed
Merge branch 'main' into refactor/xo-feedback
2 parents 689290b + 5e43d9c commit 291b44d

14 files changed

+50
-51
lines changed

demo/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<h1>
5959
<a
6060
href="https://github.com/mfranzke/loading-attribute-polyfill-with-serviceworker/"
61-
>loading-attribute-polyfill-with-serviceworker</a
61+
>loading-attribute polyfill (with Service Worker)</a
6262
>
6363
demo page
6464
</h1>
@@ -98,9 +98,6 @@ <h1>
9898
<p class="scrolling-advice">
9999
The following whitespace is included as a threshold,
100100
<strong>please scroll down to the very end of this demo page</strong> to
101-
see these images being loaded by the polyfill on The following
102-
whitespace is included as a threshold,
103-
<strong>please scroll down to the very end of this demo page</strong> to
104101
see these images and iframe content being loaded by the polyfill on
105102
<a href="https://caniuse.com/loading-lazy-attr">unsupported browsers</a>
106103
(hint:
@@ -218,7 +215,7 @@ <h2>dynamic images &amp; iframes</h2>
218215
<script type="module" src="index.js"></script>
219216
<script>
220217
if ("serviceWorker" in navigator) {
221-
// Differentiate in between the ServiceWorker scripts for the different browser capabilities / support
218+
// Differentiate in between the Service Worker scripts for the different browser capabilities / support
222219
navigator.serviceWorker.register(
223220
"../loading-attribute-polyfill.sw.js?loading-images=" +
224221
("loading" in HTMLImageElement.prototype) +

demo/index.js

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import loadingAttributePolyfill from '../dist/loading-attribute-polyfill.module.js';
2-
31
// Test for dynamically inserted images and iframes
42
let addDynamicContent = (event) => {
53
let divElement = document.createElement('div'),
@@ -40,26 +38,6 @@ document
4038
.querySelector('button.add-dynamic-content')
4139
.addEventListener('click', addDynamicContent);
4240

43-
// See https://html.spec.whatwg.org/multipage/indices.html#element-interfaces
44-
// for the list of other DOM interfaces.
45-
class LoadingImages extends HTMLImageElement {
46-
constructor() {
47-
super(); // Always call super() first in the constructor.
48-
// Call for preparing the sample image element included the latest
49-
loadingAttributePolyfill.prepareElement(this);
50-
}
51-
}
52-
53-
customElements.define('loading-image', LoadingImages, { extends: 'img' });
54-
55-
// See https://html.spec.whatwg.org/multipage/indices.html#element-interfaces
56-
// for the list of other DOM interfaces.
57-
class LoadingIframes extends HTMLIFrameElement {
58-
constructor() {
59-
super(); // Always call super() first in the constructor.
60-
// Call for preparing the sample iframe element included the latest
61-
loadingAttributePolyfill.prepareElement(this);
62-
}
63-
}
64-
65-
customElements.define('loading-iframe', LoadingIframes, { extends: 'iframe' });
41+
// Importing the two files which show how to register these elements as custom elements builtin extends
42+
import 'loading-attribute-polyfill.custom-builtin-extend.image.js';
43+
import 'loading-attribute-polyfill.custom-builtin-extend.iframe.js';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import loadingAttributePolyfill from '../dist/loading-attribute-polyfill.module.js';
2+
3+
// See https://html.spec.whatwg.org/multipage/indices.html#element-interfaces
4+
// for the list of other DOM interfaces.
5+
class LoadingIframes extends HTMLIFrameElement {
6+
constructor() {
7+
super(); // Always call super() first in the constructor.
8+
// Call for preparing the sample iframe element included the latest dynamically inserted
9+
loadingAttributePolyfill.prepareElement(this);
10+
}
11+
}
12+
13+
customElements.define('loading-iframe', LoadingIframes, { extends: 'iframe' });
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import loadingAttributePolyfill from '../dist/loading-attribute-polyfill.module.js';
2+
3+
// See https://html.spec.whatwg.org/multipage/indices.html#element-interfaces
4+
// for the list of other DOM interfaces.
5+
class LoadingImages extends HTMLImageElement {
6+
constructor() {
7+
super(); // Always call super() first in the constructor.
8+
// Call for preparing the sample image element included the latest dynamically inserted
9+
loadingAttributePolyfill.prepareElement(this);
10+
}
11+
}
12+
13+
customElements.define('loading-image', LoadingImages, { extends: 'img' });

dist/loading-attribute-polyfill.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/loading-attribute-polyfill.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/loading-attribute-polyfill.modern.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/loading-attribute-polyfill.modern.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/loading-attribute-polyfill.module.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)