marko 4.28.1 → 4.28.2
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.
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -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
|
}
|