marko 5.32.12 → 5.32.13

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.
@@ -179,7 +179,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
179
179
  (matchingFromComponent = existingComponentLookup[component.id]) ===
180
180
  undefined)
181
181
  {
182
- if (isHydrate === true) {
182
+ if (isHydrate) {
183
183
  var rootNode = beginFragmentNode(curFromNodeChild, fromNode);
184
184
  component._A_ = rootNode;
185
185
  componentByDOMNode.set(rootNode, component);
@@ -321,7 +321,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
321
321
  matchingFromEl === undefined ||
322
322
  matchingFromEl === curFromNodeChild)
323
323
  {
324
- if (isHydrate === true && curFromNodeChild) {
324
+ if (isHydrate && curFromNodeChild) {
325
325
  if (
326
326
  curFromNodeChild.nodeType === ELEMENT_NODE && (
327
327
  curToNodeChild.aa_ ||
@@ -544,7 +544,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
544
544
  // Both nodes being compared are Element nodes
545
545
  curVFromNodeChild = vElementByDOMNode.get(curFromNodeChild);
546
546
  if (curVFromNodeChild === undefined) {
547
- if (isHydrate === true) {
547
+ if (isHydrate) {
548
548
  curVFromNodeChild = virtualizeElement(curFromNodeChild);
549
549
 
550
550
  if (
@@ -587,21 +587,24 @@ function morphdom(fromNode, toNode, host, componentsContext) {
587
587
  {
588
588
  // Both nodes being compared are Text or Comment nodes
589
589
  isCompatible = true;
590
- // Simply update nodeValue on the original node to
591
- // change the text value
592
-
593
- if (
594
- isHydrate === true &&
595
- toNextSibling &&
596
- curFromNodeType === TEXT_NODE &&
597
- toNextSibling.bS_ === TEXT_NODE)
598
- {
599
- fromNextSibling = curFromNodeChild.splitText(
600
- curToNodeChild.cj_.length
601
- );
602
- }
603
- if (curFromNodeChild.nodeValue !== curToNodeChild.cj_) {
604
- curFromNodeChild.nodeValue = curToNodeChild.cj_;
590
+ var curToNodeValue = curToNodeChild.cj_;
591
+ var curFromNodeValue = curFromNodeChild.nodeValue;
592
+ if (curFromNodeValue !== curToNodeValue) {
593
+ if (
594
+ isHydrate &&
595
+ curFromNodeType === TEXT_NODE &&
596
+ curFromNodeValue.startsWith(curToNodeValue))
597
+ {
598
+ // In hydrate mode we can use splitText to more efficiently handle
599
+ // adjacent text vdom nodes that were merged.
600
+ fromNextSibling = curFromNodeChild.splitText(
601
+ curToNodeValue.length
602
+ );
603
+ } else {
604
+ // Simply update nodeValue on the original node to
605
+ // change the text value
606
+ curFromNodeChild.nodeValue = curToNodeValue;
607
+ }
605
608
  }
606
609
  }
607
610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.32.12",
3
+ "version": "5.32.13",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -179,7 +179,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
179
179
  (matchingFromComponent = existingComponentLookup[component.id]) ===
180
180
  undefined
181
181
  ) {
182
- if (isHydrate === true) {
182
+ if (isHydrate) {
183
183
  var rootNode = beginFragmentNode(curFromNodeChild, fromNode);
184
184
  component.___rootNode = rootNode;
185
185
  componentByDOMNode.set(rootNode, component);
@@ -321,7 +321,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
321
321
  matchingFromEl === undefined ||
322
322
  matchingFromEl === curFromNodeChild
323
323
  ) {
324
- if (isHydrate === true && curFromNodeChild) {
324
+ if (isHydrate && curFromNodeChild) {
325
325
  if (
326
326
  curFromNodeChild.nodeType === ELEMENT_NODE &&
327
327
  (curToNodeChild.___preserve ||
@@ -544,7 +544,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
544
544
  // Both nodes being compared are Element nodes
545
545
  curVFromNodeChild = vElementByDOMNode.get(curFromNodeChild);
546
546
  if (curVFromNodeChild === undefined) {
547
- if (isHydrate === true) {
547
+ if (isHydrate) {
548
548
  curVFromNodeChild = virtualizeElement(curFromNodeChild);
549
549
 
550
550
  if (
@@ -587,21 +587,24 @@ function morphdom(fromNode, toNode, host, componentsContext) {
587
587
  ) {
588
588
  // Both nodes being compared are Text or Comment nodes
589
589
  isCompatible = true;
590
- // Simply update nodeValue on the original node to
591
- // change the text value
592
-
593
- if (
594
- isHydrate === true &&
595
- toNextSibling &&
596
- curFromNodeType === TEXT_NODE &&
597
- toNextSibling.___nodeType === TEXT_NODE
598
- ) {
599
- fromNextSibling = curFromNodeChild.splitText(
600
- curToNodeChild.___nodeValue.length,
601
- );
602
- }
603
- if (curFromNodeChild.nodeValue !== curToNodeChild.___nodeValue) {
604
- curFromNodeChild.nodeValue = curToNodeChild.___nodeValue;
590
+ var curToNodeValue = curToNodeChild.___nodeValue;
591
+ var curFromNodeValue = curFromNodeChild.nodeValue;
592
+ if (curFromNodeValue !== curToNodeValue) {
593
+ if (
594
+ isHydrate &&
595
+ curFromNodeType === TEXT_NODE &&
596
+ curFromNodeValue.startsWith(curToNodeValue)
597
+ ) {
598
+ // In hydrate mode we can use splitText to more efficiently handle
599
+ // adjacent text vdom nodes that were merged.
600
+ fromNextSibling = curFromNodeChild.splitText(
601
+ curToNodeValue.length,
602
+ );
603
+ } else {
604
+ // Simply update nodeValue on the original node to
605
+ // change the text value
606
+ curFromNodeChild.nodeValue = curToNodeValue;
607
+ }
605
608
  }
606
609
  }
607
610
  }