mount-observer 0.0.33 → 0.0.34
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/MountObserver.js +3 -0
- package/MountObserver.ts +3 -0
- package/compose.js +6 -1
- package/compose.ts +8 -2
- package/package.json +1 -1
package/MountObserver.js
CHANGED
package/MountObserver.ts
CHANGED
|
@@ -66,6 +66,9 @@ export class MountObserver extends EventTarget implements IMountObserver{
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async #compose(el: HTMLTemplateElement, level: number){
|
|
69
|
+
if(!el.hasAttribute('src')){
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
69
72
|
const {compose} = await import('./compose.js');
|
|
70
73
|
await compose(this, el, level);
|
|
71
74
|
}
|
package/compose.js
CHANGED
|
@@ -2,6 +2,9 @@ import { inclTemplQry } from './MountObserver.js';
|
|
|
2
2
|
export const childRefsKey = Symbol.for('Wr0WPVh84k+O93miuENdMA');
|
|
3
3
|
export const cloneKey = Symbol.for('LD97VKZYc02CQv23DT/6fQ');
|
|
4
4
|
export async function compose(self, el, level) {
|
|
5
|
+
if (!el.hasAttribute('src')) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
5
8
|
const src = el.getAttribute('src');
|
|
6
9
|
el.removeAttribute('src');
|
|
7
10
|
const templID = src.substring(1);
|
|
@@ -67,7 +70,6 @@ export async function compose(self, el, level) {
|
|
|
67
70
|
}
|
|
68
71
|
slot.removeAttribute('slot');
|
|
69
72
|
}
|
|
70
|
-
el.dispatchEvent(new LoadEvent(clone));
|
|
71
73
|
}
|
|
72
74
|
if (level === 0) {
|
|
73
75
|
const refs = [];
|
|
@@ -96,6 +98,9 @@ export async function compose(self, el, level) {
|
|
|
96
98
|
el.after(clone);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
if (level === 0) {
|
|
102
|
+
el.dispatchEvent(new LoadEvent(clone));
|
|
103
|
+
}
|
|
99
104
|
if (!cloneStashed) {
|
|
100
105
|
if (level !== 0 || (slots.length === 0 && el.attributes.length === 0))
|
|
101
106
|
el.remove();
|
package/compose.ts
CHANGED
|
@@ -9,7 +9,9 @@ export async function compose(
|
|
|
9
9
|
el: HTMLTemplateElement,
|
|
10
10
|
level: number
|
|
11
11
|
){
|
|
12
|
-
|
|
12
|
+
if(!el.hasAttribute('src')){
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
13
15
|
const src = el.getAttribute('src');
|
|
14
16
|
el.removeAttribute('src');
|
|
15
17
|
const templID = src!.substring(1);
|
|
@@ -75,7 +77,7 @@ export async function compose(
|
|
|
75
77
|
}
|
|
76
78
|
slot.removeAttribute('slot');
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
|
|
79
81
|
}
|
|
80
82
|
if(level === 0){
|
|
81
83
|
const refs: Array<WeakRef<Element>> = [];
|
|
@@ -100,6 +102,10 @@ export async function compose(
|
|
|
100
102
|
el.after(clone);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
if(level === 0){
|
|
106
|
+
el.dispatchEvent(new LoadEvent(clone));
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
if(!cloneStashed){
|
|
104
110
|
if(level !== 0 || (slots.length === 0 && el.attributes.length === 0)) el.remove();
|
|
105
111
|
}
|