@webqit/oohtml 4.5.7 → 4.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +1 -1
- package/dist/main.lite.js.map +2 -2
- package/package.json +1 -1
- package/src/html-imports/HTMLModule.js +15 -8
package/package.json
CHANGED
|
@@ -31,8 +31,8 @@ export default class HTMLModule {
|
|
|
31
31
|
this.validateDefId( this.defId );
|
|
32
32
|
// ----------
|
|
33
33
|
this.realtimeA = realdom.realtime( this.host.content ).children( record => {
|
|
34
|
+
this.expose( record.exits, false ); // Must come first
|
|
34
35
|
this.expose( record.entrants, true );
|
|
35
|
-
this.expose( record.exits, false );
|
|
36
36
|
}, { live: true, timing: 'sync' } );
|
|
37
37
|
// ----------
|
|
38
38
|
this.realtimeB = realdom.realtime( this.host ).attr( [ 'src', 'loading' ], ( ...args ) => this.evaluateLoading( ...args ), {
|
|
@@ -71,7 +71,7 @@ export default class HTMLModule {
|
|
|
71
71
|
const { window } = env, { webqit: { Observer } } = window;
|
|
72
72
|
let dirty, allFragments = this.defs[ '#' ] || [];
|
|
73
73
|
entries.forEach( entry => {
|
|
74
|
-
if ( entry.nodeType !== 1 ) return;
|
|
74
|
+
if ( !entry || entry.nodeType !== 1 ) return;
|
|
75
75
|
const isTemplate = entry.matches( this.config.templateSelector );
|
|
76
76
|
const defId = ( entry.getAttribute( isTemplate ? this.config.attr.def : this.config.attr.fragmentdef ) || '' ).trim();
|
|
77
77
|
if ( isConnected ) {
|
|
@@ -133,13 +133,20 @@ export default class HTMLModule {
|
|
|
133
133
|
*
|
|
134
134
|
* @return Promise
|
|
135
135
|
*/
|
|
136
|
+
#fetchedURLs = new Set;
|
|
137
|
+
#fetchInFlight;
|
|
136
138
|
load( src ) {
|
|
137
139
|
const { window } = env;
|
|
138
|
-
if ( this.
|
|
140
|
+
if ( this.#fetchedURLs.has( src ) ) {
|
|
141
|
+
// Cache busting is needed to
|
|
142
|
+
return Promise.resolve();
|
|
143
|
+
}
|
|
144
|
+
this.#fetchedURLs.add( src );
|
|
145
|
+
if ( this.#fetchedURLs.size === 1 && this.host.content.children.length ) {
|
|
146
|
+
return Promise.resolve();
|
|
147
|
+
}
|
|
139
148
|
// Ongoing request?
|
|
140
|
-
|
|
141
|
-
this.fetchInFlight?.controller.abort();
|
|
142
|
-
|
|
149
|
+
this.#fetchInFlight?.controller.abort();
|
|
143
150
|
// The promise
|
|
144
151
|
const controller = new AbortController();
|
|
145
152
|
const fire = ( type, detail ) => this.host.dispatchEvent( new window.CustomEvent( type, { detail } ) );
|
|
@@ -151,11 +158,11 @@ export default class HTMLModule {
|
|
|
151
158
|
return this.host;
|
|
152
159
|
} ).catch( e => {
|
|
153
160
|
console.error( `Error fetching the bundle at "${ src }": ${ e.message }` );
|
|
154
|
-
this
|
|
161
|
+
this.#fetchInFlight = null;
|
|
155
162
|
fire( 'loaderror' );
|
|
156
163
|
return this.host;
|
|
157
164
|
} );
|
|
158
|
-
this
|
|
165
|
+
this.#fetchInFlight = { request, controller };
|
|
159
166
|
return request;
|
|
160
167
|
}
|
|
161
168
|
|