marko 5.32.6 → 5.32.8

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.
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var VElement = require("../vdom").br_;
4
+ var i = 0;
5
+
6
+ module.exports = function (tagName, attrs, childCount) {
7
+ return new ConstVElement(tagName, attrs, childCount);
8
+ };
9
+
10
+ function ConstVElement(tagName, attrs, childCount) {
11
+ VElement.call(this, tagName, attrs, null, null, childCount, null, { i: i++ });
12
+ }
13
+
14
+ ConstVElement.prototype = Object.create(VElement.prototype);
15
+ ConstVElement.prototype.e = function (tagName, attrs, childCount) {
16
+ var child = this.bI_(
17
+ new ConstVElement(tagName, attrs, childCount)
18
+ );
19
+
20
+ if (childCount === 0) {
21
+ return this.ca_();
22
+ } else {
23
+ return child;
24
+ }
25
+ };
@@ -281,13 +281,26 @@ function morphdom(fromNode, toNode, host, componentsContext) {
281
281
  if (!curToNodeChild.aa_) {
282
282
  // We just skip over the fromNode if it is preserved
283
283
 
284
- if (compareNodeNames(curToNodeChild, curVFromNodeChild)) {
285
- morphEl(
286
- curFromNodeChild,
287
- curVFromNodeChild,
288
- curToNodeChild,
289
- parentComponent
290
- );
284
+ if (
285
+ curVFromNodeChild &&
286
+ curToNodeType === curVFromNodeChild.bS_ && (
287
+ curToNodeType !== ELEMENT_NODE ||
288
+ compareNodeNames(curToNodeChild, curVFromNodeChild)))
289
+ {
290
+ if (curToNodeType === ELEMENT_NODE) {
291
+ morphEl(
292
+ curFromNodeChild,
293
+ curVFromNodeChild,
294
+ curToNodeChild,
295
+ parentComponent
296
+ );
297
+ } else {
298
+ morphChildren(
299
+ curFromNodeChild,
300
+ curToNodeChild,
301
+ parentComponent
302
+ );
303
+ }
291
304
  } else {
292
305
  // Remove the old node
293
306
  detachNode(curFromNodeChild, fromNode, ownerComponent);
@@ -404,7 +417,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
404
417
  if (!curToNodeChild.aa_) {
405
418
  curVFromNodeChild = vElementByDOMNode.get(matchingFromEl);
406
419
 
407
- if (compareNodeNames(curVFromNodeChild, curToNodeChild)) {
420
+ if (
421
+ curVFromNodeChild &&
422
+ curToNodeType === curVFromNodeChild.bS_ && (
423
+ curToNodeType !== ELEMENT_NODE ||
424
+ compareNodeNames(curVFromNodeChild, curToNodeChild)))
425
+ {
408
426
  if (fromNextSibling === matchingFromEl) {
409
427
  // Single element removal:
410
428
  // A <-> A
@@ -455,12 +473,20 @@ function morphdom(fromNode, toNode, host, componentsContext) {
455
473
  }
456
474
  }
457
475
 
458
- morphEl(
459
- matchingFromEl,
460
- curVFromNodeChild,
461
- curToNodeChild,
462
- parentComponent
463
- );
476
+ if (curToNodeType === ELEMENT_NODE) {
477
+ morphEl(
478
+ matchingFromEl,
479
+ curVFromNodeChild,
480
+ curToNodeChild,
481
+ parentComponent
482
+ );
483
+ } else {
484
+ morphChildren(
485
+ matchingFromEl,
486
+ curToNodeChild,
487
+ parentComponent
488
+ );
489
+ }
464
490
  } else {
465
491
  insertVirtualNodeBefore(
466
492
  curToNodeChild,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.32.6",
3
+ "version": "5.32.8",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -64,8 +64,8 @@
64
64
  "build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production"
65
65
  },
66
66
  "dependencies": {
67
- "@marko/compiler": "^5.34.5",
68
- "@marko/translator-default": "^5.31.12",
67
+ "@marko/compiler": "^5.34.6",
68
+ "@marko/translator-default": "^5.31.14",
69
69
  "app-module-path": "^2.2.0",
70
70
  "argly": "^1.2.0",
71
71
  "browser-refresh-client": "1.1.4",
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var VElement = require("../vdom").___VElement;
4
+ var i = 0;
5
+
6
+ module.exports = function (tagName, attrs, childCount) {
7
+ return new ConstVElement(tagName, attrs, childCount);
8
+ };
9
+
10
+ function ConstVElement(tagName, attrs, childCount) {
11
+ VElement.call(this, tagName, attrs, null, null, childCount, null, { i: i++ });
12
+ }
13
+
14
+ ConstVElement.prototype = Object.create(VElement.prototype);
15
+ ConstVElement.prototype.e = function (tagName, attrs, childCount) {
16
+ var child = this.___appendChild(
17
+ new ConstVElement(tagName, attrs, childCount),
18
+ );
19
+
20
+ if (childCount === 0) {
21
+ return this.___finishChild();
22
+ } else {
23
+ return child;
24
+ }
25
+ };
@@ -281,13 +281,26 @@ function morphdom(fromNode, toNode, host, componentsContext) {
281
281
  if (!curToNodeChild.___preserve) {
282
282
  // We just skip over the fromNode if it is preserved
283
283
 
284
- if (compareNodeNames(curToNodeChild, curVFromNodeChild)) {
285
- morphEl(
286
- curFromNodeChild,
287
- curVFromNodeChild,
288
- curToNodeChild,
289
- parentComponent,
290
- );
284
+ if (
285
+ curVFromNodeChild &&
286
+ curToNodeType === curVFromNodeChild.___nodeType &&
287
+ (curToNodeType !== ELEMENT_NODE ||
288
+ compareNodeNames(curToNodeChild, curVFromNodeChild))
289
+ ) {
290
+ if (curToNodeType === ELEMENT_NODE) {
291
+ morphEl(
292
+ curFromNodeChild,
293
+ curVFromNodeChild,
294
+ curToNodeChild,
295
+ parentComponent,
296
+ );
297
+ } else {
298
+ morphChildren(
299
+ curFromNodeChild,
300
+ curToNodeChild,
301
+ parentComponent,
302
+ );
303
+ }
291
304
  } else {
292
305
  // Remove the old node
293
306
  detachNode(curFromNodeChild, fromNode, ownerComponent);
@@ -404,7 +417,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
404
417
  if (!curToNodeChild.___preserve) {
405
418
  curVFromNodeChild = vElementByDOMNode.get(matchingFromEl);
406
419
 
407
- if (compareNodeNames(curVFromNodeChild, curToNodeChild)) {
420
+ if (
421
+ curVFromNodeChild &&
422
+ curToNodeType === curVFromNodeChild.___nodeType &&
423
+ (curToNodeType !== ELEMENT_NODE ||
424
+ compareNodeNames(curVFromNodeChild, curToNodeChild))
425
+ ) {
408
426
  if (fromNextSibling === matchingFromEl) {
409
427
  // Single element removal:
410
428
  // A <-> A
@@ -455,12 +473,20 @@ function morphdom(fromNode, toNode, host, componentsContext) {
455
473
  }
456
474
  }
457
475
 
458
- morphEl(
459
- matchingFromEl,
460
- curVFromNodeChild,
461
- curToNodeChild,
462
- parentComponent,
463
- );
476
+ if (curToNodeType === ELEMENT_NODE) {
477
+ morphEl(
478
+ matchingFromEl,
479
+ curVFromNodeChild,
480
+ curToNodeChild,
481
+ parentComponent,
482
+ );
483
+ } else {
484
+ morphChildren(
485
+ matchingFromEl,
486
+ curToNodeChild,
487
+ parentComponent,
488
+ );
489
+ }
464
490
  } else {
465
491
  insertVirtualNodeBefore(
466
492
  curToNodeChild,
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (id) {
4
- var i = 0;
5
- return function () {
6
- return id + i++;
7
- };
8
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- var VElement = require("../vdom").br_;
4
-
5
- module.exports = function (
6
- tagName,
7
- attrs,
8
- key,
9
- component,
10
- childCount,
11
- flags,
12
- props)
13
- {
14
- return new VElement(tagName, attrs, key, component, childCount, flags, props);
15
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- var VText = require("../vdom").bt_;
4
-
5
- module.exports = function (value) {
6
- return new VText(value);
7
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (id) {
4
- var i = 0;
5
- return function () {
6
- return id + i++;
7
- };
8
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- var VElement = require("../vdom").___VElement;
4
-
5
- module.exports = function (
6
- tagName,
7
- attrs,
8
- key,
9
- component,
10
- childCount,
11
- flags,
12
- props,
13
- ) {
14
- return new VElement(tagName, attrs, key, component, childCount, flags, props);
15
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- var VText = require("../vdom").___VText;
4
-
5
- module.exports = function (value) {
6
- return new VText(value);
7
- };