@sprlab/wccompiler 0.5.13 → 0.5.14
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/lib/tree-walker.js +10 -8
- package/package.json +1 -1
package/lib/tree-walker.js
CHANGED
|
@@ -369,17 +369,19 @@ export function walkBranch(html, signalNames, computedNames, propNames) {
|
|
|
369
369
|
const { document } = parseHTML(`<div id="__branchRoot">${html}</div>`);
|
|
370
370
|
const branchRoot = document.getElementById('__branchRoot');
|
|
371
371
|
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
//
|
|
372
|
+
// Process nested structural directives FIRST (before walkTree modifies the DOM).
|
|
373
|
+
// This is critical because walkTree clears textContent of elements with sole
|
|
374
|
+
// {{interpolation}} children, which would destroy content needed by
|
|
375
|
+
// processForBlocks/processIfChains when they clone nested elements for their
|
|
376
|
+
// own walkBranch calls.
|
|
376
377
|
const forBlocks = processForBlocks(branchRoot, [], signalNames, computedNames, propNames);
|
|
377
|
-
|
|
378
|
-
// Detect nested if/else-if/else chains within the branch template
|
|
379
378
|
const ifBlocks = processIfChains(branchRoot, [], signalNames, computedNames, propNames);
|
|
380
379
|
|
|
381
|
-
//
|
|
382
|
-
//
|
|
380
|
+
// Now run walkTree on the remaining DOM (nested directive elements have been
|
|
381
|
+
// replaced with comment nodes, so walkTree won't process their contents).
|
|
382
|
+
const result = walkTree(branchRoot, signalNames, computedNames, propNames);
|
|
383
|
+
|
|
384
|
+
// Capture the processed HTML AFTER all processing
|
|
383
385
|
const processedHtml = branchRoot.innerHTML;
|
|
384
386
|
|
|
385
387
|
// Strip the first path segment from all paths since at runtime
|
package/package.json
CHANGED