mount-observer 0.0.84 → 0.0.85
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/package.json +1 -1
- package/preloadContent.js +2 -1
- package/preloadContent.ts +2 -1
- package/upShadowSearch.js +5 -1
- package/upShadowSearch.ts +5 -1
package/package.json
CHANGED
package/preloadContent.js
CHANGED
|
@@ -23,7 +23,7 @@ Object.defineProperty(HTMLTemplateElement.prototype, 'remoteContent', {
|
|
|
23
23
|
{
|
|
24
24
|
const test = templ[remoteTemplElSym]?.deref();
|
|
25
25
|
if (test !== undefined)
|
|
26
|
-
return test;
|
|
26
|
+
return test.content;
|
|
27
27
|
if (templ.getAttribute('rel') !== 'preload')
|
|
28
28
|
throw 'NI';
|
|
29
29
|
const isIntraDoc = src[0] === '#';
|
|
@@ -34,6 +34,7 @@ Object.defineProperty(HTMLTemplateElement.prototype, 'remoteContent', {
|
|
|
34
34
|
if (!(remoteTempl instanceof HTMLTemplateElement))
|
|
35
35
|
throw 404; //not found
|
|
36
36
|
templ[remoteTemplElSym] = new WeakRef(remoteTempl);
|
|
37
|
+
return remoteTempl.content;
|
|
37
38
|
//templ.dispatchEvent(new Event('load'));
|
|
38
39
|
}
|
|
39
40
|
}
|
package/preloadContent.ts
CHANGED
|
@@ -24,7 +24,7 @@ Object.defineProperty(HTMLTemplateElement.prototype, 'remoteContent', {
|
|
|
24
24
|
}
|
|
25
25
|
{
|
|
26
26
|
const test = (<any>templ)[remoteTemplElSym]?.deref();
|
|
27
|
-
if(test !== undefined) return test;
|
|
27
|
+
if(test !== undefined) return test.content;
|
|
28
28
|
if(templ.getAttribute('rel') !== 'preload') throw 'NI';
|
|
29
29
|
const isIntraDoc = src[0] === '#';
|
|
30
30
|
if(!isIntraDoc) throw 'NI';
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(HTMLTemplateElement.prototype, 'remoteContent', {
|
|
|
32
32
|
const remoteTempl = upShadowSearch(templ, id);
|
|
33
33
|
if(!(remoteTempl instanceof HTMLTemplateElement)) throw 404; //not found
|
|
34
34
|
(<any>templ)[remoteTemplElSym] = new WeakRef(remoteTempl);
|
|
35
|
+
return remoteTempl.content;
|
|
35
36
|
//templ.dispatchEvent(new Event('load'));
|
|
36
37
|
}
|
|
37
38
|
|
package/upShadowSearch.js
CHANGED
package/upShadowSearch.ts
CHANGED
|
@@ -9,8 +9,12 @@ export function upShadowSearch(ref: Element, id: string){
|
|
|
9
9
|
rn = rn.host.getRootNode() as (DocumentFragment | ShadowRoot) & { host?: Element };
|
|
10
10
|
}else if(rn === document){
|
|
11
11
|
return null;
|
|
12
|
+
}else if(!rn.isConnected){
|
|
13
|
+
//TODO: search first for targetFragment
|
|
14
|
+
rn = document;
|
|
15
|
+
|
|
12
16
|
}
|
|
13
|
-
return null;
|
|
17
|
+
//return null;
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
|