marko 4.28.1 → 4.28.3
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/compiler/Normalizer.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +15 -11
- package/dist/taglib/taglib-loader/loadTaglibFromProps.js +3 -0
- package/package.json +1 -1
- package/src/compiler/Normalizer.js +1 -1
- package/src/runtime/vdom/morphdom/index.js +21 -18
- package/src/taglib/taglib-loader/loadTaglibFromProps.js +3 -0
@@ -107,7 +107,7 @@ class Normalizer {
|
|
107
107
|
} else if (context.ignoreUnrecognizedTags && tagName[0] === "@") {
|
108
108
|
let owner = elNode.parentNode;
|
109
109
|
|
110
|
-
while (owner && /^(?:for|while|if|else(?:-if))
|
110
|
+
while (owner && /^(?:for|while|if|else(?:-if))$|^@/.test(owner.tagName)) {
|
111
111
|
owner = owner.parentNode;
|
112
112
|
}
|
113
113
|
|
@@ -148,7 +148,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
148
148
|
if (curToNodeType === COMPONENT_NODE) {
|
149
149
|
var component = curToNodeChild.v_;
|
150
150
|
if ((matchingFromComponent = existingComponentLookup[component.id]) === undefined) {
|
151
|
-
if (isHydrate
|
151
|
+
if (isHydrate) {
|
152
152
|
var rootNode = beginFragmentNode(curFromNodeChild, fromNode);
|
153
153
|
component._E_ = rootNode;
|
154
154
|
componentByDOMNode.set(rootNode, component);
|
@@ -236,7 +236,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
236
236
|
} else {
|
237
237
|
matchingFromEl = referenceComponent.N_[curToNodeKey];
|
238
238
|
if (matchingFromEl === undefined || matchingFromEl === curFromNodeChild) {
|
239
|
-
if (isHydrate
|
239
|
+
if (isHydrate && curFromNodeChild) {
|
240
240
|
if (curFromNodeChild.nodeType === ELEMENT_NODE && (curToNodeChild.ae_ || caseInsensitiveCompare(curFromNodeChild.nodeName, curToNodeChild.cd_ || ""))) {
|
241
241
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
242
242
|
curVFromNodeChild.cd_ = curToNodeChild.cd_;
|
@@ -406,7 +406,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
406
406
|
// Both nodes being compared are Element nodes
|
407
407
|
curVFromNodeChild = vElementByDOMNode.get(curFromNodeChild);
|
408
408
|
if (curVFromNodeChild === undefined) {
|
409
|
-
if (isHydrate
|
409
|
+
if (isHydrate) {
|
410
410
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
411
411
|
|
412
412
|
if (caseInsensitiveCompare(curVFromNodeChild.cd_, curToNodeChild.cd_)) {
|
@@ -434,14 +434,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
434
434
|
} else if (curFromNodeType === TEXT_NODE || curFromNodeType === COMMENT_NODE) {
|
435
435
|
// Both nodes being compared are Text or Comment nodes
|
436
436
|
isCompatible = true;
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
437
|
+
var curToNodeValue = curToNodeChild.bW_;
|
438
|
+
var curFromNodeValue = curFromNodeChild.nodeValue;
|
439
|
+
if (curFromNodeValue !== curToNodeValue) {
|
440
|
+
if (isHydrate && curFromNodeType === TEXT_NODE && curFromNodeValue.startsWith(curToNodeValue)) {
|
441
|
+
// In hydrate mode we can use splitText to more efficiently handle
|
442
|
+
// adjacent text vdom nodes that were merged.
|
443
|
+
fromNextSibling = curFromNodeChild.splitText(curToNodeValue.length);
|
444
|
+
} else {
|
445
|
+
// Simply update nodeValue on the original node to
|
446
|
+
// change the text value
|
447
|
+
curFromNodeChild.nodeValue = curToNodeValue;
|
448
|
+
}
|
445
449
|
}
|
446
450
|
}
|
447
451
|
}
|
@@ -197,6 +197,9 @@ class TaglibLoader {
|
|
197
197
|
}
|
198
198
|
}
|
199
199
|
}
|
200
|
+
scriptLang() {
|
201
|
+
// Marko 4 doesn't read script-lang, but it shouldn't break the app
|
202
|
+
}
|
200
203
|
tagsDir(dir) {
|
201
204
|
// The "tags-dir" property is used to supporting scanning
|
202
205
|
// of a directory to discover custom tags. Scanning a directory
|
package/package.json
CHANGED
@@ -125,7 +125,7 @@ class Normalizer {
|
|
125
125
|
} else if (context.ignoreUnrecognizedTags && tagName[0] === "@") {
|
126
126
|
let owner = elNode.parentNode;
|
127
127
|
|
128
|
-
while (owner && /^(?:for|while|if|else(?:-if))
|
128
|
+
while (owner && /^(?:for|while|if|else(?:-if))$|^@/.test(owner.tagName)) {
|
129
129
|
owner = owner.parentNode;
|
130
130
|
}
|
131
131
|
|
@@ -180,7 +180,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
180
180
|
(matchingFromComponent = existingComponentLookup[component.id]) ===
|
181
181
|
undefined
|
182
182
|
) {
|
183
|
-
if (isHydrate
|
183
|
+
if (isHydrate) {
|
184
184
|
var rootNode = beginFragmentNode(curFromNodeChild, fromNode);
|
185
185
|
component.___rootNode = rootNode;
|
186
186
|
componentByDOMNode.set(rootNode, component);
|
@@ -322,7 +322,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
322
322
|
matchingFromEl === undefined ||
|
323
323
|
matchingFromEl === curFromNodeChild
|
324
324
|
) {
|
325
|
-
if (isHydrate
|
325
|
+
if (isHydrate && curFromNodeChild) {
|
326
326
|
if (
|
327
327
|
curFromNodeChild.nodeType === ELEMENT_NODE &&
|
328
328
|
(curToNodeChild.___preserve ||
|
@@ -546,7 +546,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
546
546
|
// Both nodes being compared are Element nodes
|
547
547
|
curVFromNodeChild = vElementByDOMNode.get(curFromNodeChild);
|
548
548
|
if (curVFromNodeChild === undefined) {
|
549
|
-
if (isHydrate
|
549
|
+
if (isHydrate) {
|
550
550
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
551
551
|
|
552
552
|
if (
|
@@ -589,21 +589,24 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
589
589
|
) {
|
590
590
|
// Both nodes being compared are Text or Comment nodes
|
591
591
|
isCompatible = true;
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
592
|
+
var curToNodeValue = curToNodeChild.___nodeValue;
|
593
|
+
var curFromNodeValue = curFromNodeChild.nodeValue;
|
594
|
+
if (curFromNodeValue !== curToNodeValue) {
|
595
|
+
if (
|
596
|
+
isHydrate &&
|
597
|
+
curFromNodeType === TEXT_NODE &&
|
598
|
+
curFromNodeValue.startsWith(curToNodeValue)
|
599
|
+
) {
|
600
|
+
// In hydrate mode we can use splitText to more efficiently handle
|
601
|
+
// adjacent text vdom nodes that were merged.
|
602
|
+
fromNextSibling = curFromNodeChild.splitText(
|
603
|
+
curToNodeValue.length,
|
604
|
+
);
|
605
|
+
} else {
|
606
|
+
// Simply update nodeValue on the original node to
|
607
|
+
// change the text value
|
608
|
+
curFromNodeChild.nodeValue = curToNodeValue;
|
609
|
+
}
|
607
610
|
}
|
608
611
|
}
|
609
612
|
}
|
@@ -222,6 +222,9 @@ class TaglibLoader {
|
|
222
222
|
}
|
223
223
|
}
|
224
224
|
}
|
225
|
+
scriptLang() {
|
226
|
+
// Marko 4 doesn't read script-lang, but it shouldn't break the app
|
227
|
+
}
|
225
228
|
tagsDir(dir) {
|
226
229
|
// The "tags-dir" property is used to supporting scanning
|
227
230
|
// of a directory to discover custom tags. Scanning a directory
|