@fluffjs/fluff 0.4.3 → 0.4.4
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
CHANGED
|
@@ -36,6 +36,7 @@ export declare abstract class MarkerController {
|
|
|
36
36
|
private __getFluffElementHost;
|
|
37
37
|
protected setScopeOnChildren(node: Node, scope: Scope, renderContext?: RenderContext, markerManager?: MarkerManagerLike, bindingsSubscriptions?: Subscription[]): void;
|
|
38
38
|
protected cloneAndInsertTemplate(template: HTMLTemplateElement, context: Record<string, unknown>, renderContext: RenderContext | undefined, bindingsSubscriptions: Subscription[]): void;
|
|
39
|
+
private unwrapNamespaceWrapper;
|
|
39
40
|
protected processBindingsOnNode(node: HTMLElement, scope: Scope, bindingsSubscriptions?: Subscription[]): void;
|
|
40
41
|
}
|
|
41
42
|
export {};
|
|
@@ -196,13 +196,27 @@ export class MarkerController {
|
|
|
196
196
|
if (!(content instanceof DocumentFragment)) {
|
|
197
197
|
throw new Error('Expected DocumentFragment from template clone');
|
|
198
198
|
}
|
|
199
|
-
const
|
|
199
|
+
const unwrappedContent = this.unwrapNamespaceWrapper(content);
|
|
200
|
+
const nodes = Array.from(unwrappedContent.childNodes);
|
|
200
201
|
const scope = this.createChildScope(context);
|
|
201
|
-
this.insertBeforeEndMarker(
|
|
202
|
+
this.insertBeforeEndMarker(unwrappedContent);
|
|
202
203
|
for (const node of nodes) {
|
|
203
204
|
this.setScopeOnChildren(node, scope, renderContext, this.markerManager, bindingsSubscriptions);
|
|
204
205
|
}
|
|
205
206
|
}
|
|
207
|
+
unwrapNamespaceWrapper(content) {
|
|
208
|
+
if (content.childNodes.length === 1) {
|
|
209
|
+
const { firstChild } = content;
|
|
210
|
+
if (firstChild instanceof Element && firstChild.hasAttribute('data-fluff-ns-wrapper')) {
|
|
211
|
+
const unwrapped = document.createDocumentFragment();
|
|
212
|
+
while (firstChild.firstChild) {
|
|
213
|
+
unwrapped.appendChild(firstChild.firstChild);
|
|
214
|
+
}
|
|
215
|
+
return unwrapped;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return content;
|
|
219
|
+
}
|
|
206
220
|
processBindingsOnNode(node, scope, bindingsSubscriptions) {
|
|
207
221
|
const fluffHost = this.__getFluffElementHost();
|
|
208
222
|
if (!fluffHost)
|