marko 5.35.23 → 5.35.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtime/vdom/VElement.js +5 -4
- package/dist/runtime/vdom/VNode.js +4 -2
- package/dist/runtime/vdom/is-text-only.js +10 -0
- package/dist/runtime/vdom/morphdom/index.js +8 -3
- package/package.json +3 -3
- package/src/runtime/vdom/VElement.js +7 -6
- package/src/runtime/vdom/VNode.js +4 -2
- package/src/runtime/vdom/is-text-only.js +10 -0
- package/src/runtime/vdom/morphdom/index.js +9 -4
@@ -5,6 +5,7 @@ var componentsUtil = require("@internal/components-util");
|
|
5
5
|
var domData = require("../components/dom-data");
|
6
6
|
var vElementByDOMNode = domData._L_;
|
7
7
|
var VNode = require("./VNode");
|
8
|
+
var isTextOnly = require("./is-text-only");
|
8
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
9
10
|
var xmlnsRegExp = /^xmlns(:|$)/;
|
10
11
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
@@ -194,8 +195,8 @@ VElement.prototype = {
|
|
194
195
|
}
|
195
196
|
}
|
196
197
|
|
197
|
-
if (tagName
|
198
|
-
el.
|
198
|
+
if (isTextOnly(tagName)) {
|
199
|
+
el.textContent = this.ch_;
|
199
200
|
}
|
200
201
|
}
|
201
202
|
|
@@ -249,8 +250,8 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
249
250
|
props
|
250
251
|
);
|
251
252
|
|
252
|
-
if (
|
253
|
-
vdomEl.ch_ = node.
|
253
|
+
if (isTextOnly(tagName)) {
|
254
|
+
vdomEl.ch_ = node.textContent;
|
254
255
|
} else if (virtualizeChildNodes) {
|
255
256
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
256
257
|
}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";var hasTextContent = require("./is-text-only");
|
2
|
+
|
3
|
+
function VNode() {}
|
2
4
|
|
3
5
|
VNode.prototype = {
|
4
6
|
bY_: function (finalChildCount, ownerComponent) {
|
@@ -47,7 +49,7 @@ VNode.prototype = {
|
|
47
49
|
bR_: function (child) {
|
48
50
|
this.cn_++;
|
49
51
|
|
50
|
-
if (this.cg_
|
52
|
+
if (hasTextContent(this.cg_)) {
|
51
53
|
if (child.cq_) {
|
52
54
|
this.ch_ += child.bZ_;
|
53
55
|
} else {
|
@@ -11,6 +11,7 @@ var KeySequence = require("../../components/KeySequence");
|
|
11
11
|
var VElement = require("../vdom").bz_;
|
12
12
|
var fragment = require("./fragment");
|
13
13
|
var helpers = require("./helpers");
|
14
|
+
var isTextOnly = require("../is-text-only");
|
14
15
|
var virtualizeElement = VElement.ck_;
|
15
16
|
var morphAttrs = VElement.cl_;
|
16
17
|
var keysByDOMNode = domData._o_;
|
@@ -87,7 +88,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
87
88
|
realNode;
|
88
89
|
}
|
89
90
|
|
90
|
-
if (vNode.cg_
|
91
|
+
if (!isTextOnly(vNode.cg_)) {
|
91
92
|
morphChildren(realNode, vNode, parentComponent);
|
92
93
|
}
|
93
94
|
|
@@ -699,9 +700,13 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
699
700
|
return;
|
700
701
|
}
|
701
702
|
|
702
|
-
if (nodeName
|
703
|
+
if (isTextOnly(nodeName)) {
|
703
704
|
if (toEl.ch_ !== vFromEl.ch_) {
|
704
|
-
|
705
|
+
if (nodeName === "textarea") {
|
706
|
+
fromEl.value = toEl.ch_;
|
707
|
+
} else {
|
708
|
+
fromEl.textContent = toEl.ch_;
|
709
|
+
}
|
705
710
|
}
|
706
711
|
} else {
|
707
712
|
morphChildren(fromEl, toEl, parentComponent);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.35.
|
3
|
+
"version": "5.35.24",
|
4
4
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
5
5
|
"keywords": [
|
6
6
|
"front-end",
|
@@ -66,8 +66,8 @@
|
|
66
66
|
"build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
|
67
67
|
},
|
68
68
|
"dependencies": {
|
69
|
-
"@marko/compiler": "^5.37.
|
70
|
-
"@marko/translator-default": "^6.0.
|
69
|
+
"@marko/compiler": "^5.37.17",
|
70
|
+
"@marko/translator-default": "^6.0.18",
|
71
71
|
"app-module-path": "^2.2.0",
|
72
72
|
"argly": "^1.2.0",
|
73
73
|
"browser-refresh-client": "1.1.4",
|
@@ -5,6 +5,7 @@ var componentsUtil = require("@internal/components-util");
|
|
5
5
|
var domData = require("../components/dom-data");
|
6
6
|
var vElementByDOMNode = domData.___vElementByDOMNode;
|
7
7
|
var VNode = require("./VNode");
|
8
|
+
var isTextOnly = require("./is-text-only");
|
8
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
9
10
|
var xmlnsRegExp = /^xmlns(:|$)/;
|
10
11
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
@@ -89,7 +90,7 @@ function VElementClone(other) {
|
|
89
90
|
this.___properties = other.___properties;
|
90
91
|
this.___nodeName = other.___nodeName;
|
91
92
|
this.___flags = other.___flags;
|
92
|
-
this.
|
93
|
+
this.___textContent = other.___textContent;
|
93
94
|
this.___constId = other.___constId;
|
94
95
|
}
|
95
96
|
|
@@ -115,7 +116,7 @@ function VElement(
|
|
115
116
|
this.___attributes = attrs || EMPTY_OBJECT;
|
116
117
|
this.___properties = props || EMPTY_OBJECT;
|
117
118
|
this.___nodeName = tagName;
|
118
|
-
this.
|
119
|
+
this.___textContent = "";
|
119
120
|
this.___constId = constId;
|
120
121
|
this.___preserve = false;
|
121
122
|
this.___preserveBody = false;
|
@@ -194,8 +195,8 @@ VElement.prototype = {
|
|
194
195
|
}
|
195
196
|
}
|
196
197
|
|
197
|
-
if (tagName
|
198
|
-
el.
|
198
|
+
if (isTextOnly(tagName)) {
|
199
|
+
el.textContent = this.___textContent;
|
199
200
|
}
|
200
201
|
}
|
201
202
|
|
@@ -249,8 +250,8 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
249
250
|
props,
|
250
251
|
);
|
251
252
|
|
252
|
-
if (
|
253
|
-
vdomEl.
|
253
|
+
if (isTextOnly(tagName)) {
|
254
|
+
vdomEl.___textContent = node.textContent;
|
254
255
|
} else if (virtualizeChildNodes) {
|
255
256
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
256
257
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
var hasTextContent = require("./is-text-only");
|
2
|
+
|
1
3
|
function VNode() {}
|
2
4
|
|
3
5
|
VNode.prototype = {
|
@@ -47,9 +49,9 @@ VNode.prototype = {
|
|
47
49
|
___appendChild: function (child) {
|
48
50
|
this.___childCount++;
|
49
51
|
|
50
|
-
if (this.___nodeName
|
52
|
+
if (hasTextContent(this.___nodeName)) {
|
51
53
|
if (child.___Text) {
|
52
|
-
this.
|
54
|
+
this.___textContent += child.___nodeValue;
|
53
55
|
} else {
|
54
56
|
throw TypeError();
|
55
57
|
}
|
@@ -11,6 +11,7 @@ var KeySequence = require("../../components/KeySequence");
|
|
11
11
|
var VElement = require("../vdom").___VElement;
|
12
12
|
var fragment = require("./fragment");
|
13
13
|
var helpers = require("./helpers");
|
14
|
+
var isTextOnly = require("../is-text-only");
|
14
15
|
var virtualizeElement = VElement.___virtualize;
|
15
16
|
var morphAttrs = VElement.___morphAttrs;
|
16
17
|
var keysByDOMNode = domData.___keyByDOMNode;
|
@@ -87,7 +88,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
87
88
|
] = realNode;
|
88
89
|
}
|
89
90
|
|
90
|
-
if (vNode.___nodeName
|
91
|
+
if (!isTextOnly(vNode.___nodeName)) {
|
91
92
|
morphChildren(realNode, vNode, parentComponent);
|
92
93
|
}
|
93
94
|
|
@@ -699,9 +700,13 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
699
700
|
return;
|
700
701
|
}
|
701
702
|
|
702
|
-
if (nodeName
|
703
|
-
if (toEl.
|
704
|
-
|
703
|
+
if (isTextOnly(nodeName)) {
|
704
|
+
if (toEl.___textContent !== vFromEl.___textContent) {
|
705
|
+
if (nodeName === "textarea") {
|
706
|
+
fromEl.value = toEl.___textContent;
|
707
|
+
} else {
|
708
|
+
fromEl.textContent = toEl.___textContent;
|
709
|
+
}
|
705
710
|
}
|
706
711
|
} else {
|
707
712
|
morphChildren(fromEl, toEl, parentComponent);
|