marko 4.28.1 → 4.28.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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))$/.test(owner.tagName)) {
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 === true) {
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 === true && curFromNodeChild) {
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 === true) {
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
- // Simply update nodeValue on the original node to
438
- // change the text value
439
-
440
- if (isHydrate === true && toNextSibling && curFromNodeType === TEXT_NODE && toNextSibling.bX_ === TEXT_NODE) {
441
- fromNextSibling = curFromNodeChild.splitText(curToNodeChild.bW_.length);
442
- }
443
- if (curFromNodeChild.nodeValue !== curToNodeChild.bW_) {
444
- curFromNodeChild.nodeValue = curToNodeChild.bW_;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "4.28.1",
3
+ "version": "4.28.3",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
@@ -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))$/.test(owner.tagName)) {
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 === true) {
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 === true && curFromNodeChild) {
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 === true) {
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
- // Simply update nodeValue on the original node to
593
- // change the text value
594
-
595
- if (
596
- isHydrate === true &&
597
- toNextSibling &&
598
- curFromNodeType === TEXT_NODE &&
599
- toNextSibling.___nodeType === TEXT_NODE
600
- ) {
601
- fromNextSibling = curFromNodeChild.splitText(
602
- curToNodeChild.___nodeValue.length
603
- );
604
- }
605
- if (curFromNodeChild.nodeValue !== curToNodeChild.___nodeValue) {
606
- curFromNodeChild.nodeValue = curToNodeChild.___nodeValue;
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