marko 5.39.50 → 5.40.0
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.
- package/dist/compiler/index.js +0 -2
- package/dist/core-tags/core/await/index.d.marko +17 -0
- package/dist/core-tags/core/script.d.marko +6 -1
- package/dist/runtime/helpers/dynamic-tag.js +11 -4
- package/dist/runtime/helpers/load-tag.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/dom.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html.js +3 -1
- package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +50 -51
- package/dist/runtime/helpers/tags-compat/runtime-html.js +18 -20
- package/dist/runtime/html/AsyncStream.js +10 -10
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/renderable.js +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -65
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +6 -6
- package/dist/runtime/vdom/VElement.js +39 -58
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +29 -29
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +3 -3
- package/dist/runtime/vdom/morphdom/helpers.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +34 -35
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/taglib/index.js +3 -6
- package/dist/translator/index.js +8 -23
- package/dist/translator/tag/attribute/index.js +0 -16
- package/dist/translator/tag/attribute-tag.js +4 -11
- package/dist/translator/tag/custom-tag.js +1 -2
- package/dist/translator/tag/native-tag[html]/index.js +1 -13
- package/dist/translator/tag/native-tag[vdom]/index.js +0 -12
- package/dist/translator/tag/util.js +69 -55
- package/dist/translator/taglib/core/index.js +17 -366
- package/dist/translator/util/get-component-files.js +1 -1
- package/dist/translator/util/runtime-flags.js +2 -3
- package/dist/translator.js +4 -2
- package/docs/marko-json.md +3 -6
- package/index.d.ts +3 -8
- package/package.json +4 -4
- package/src/compiler/index.js +0 -2
- package/src/core-tags/core/await/index.d.marko +17 -0
- package/src/core-tags/core/script.d.marko +6 -1
- package/src/runtime/helpers/dynamic-tag.js +10 -3
- package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/dom.js +1 -1
- package/src/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html.js +3 -1
- package/src/runtime/helpers/tags-compat/html.mjs +1 -1
- package/src/runtime/helpers/tags-compat/runtime-dom.js +40 -41
- package/src/runtime/helpers/tags-compat/runtime-html.js +14 -16
- package/src/runtime/vdom/VElement.js +10 -29
- package/src/runtime/vdom/morphdom/index.js +0 -1
- package/src/taglib/index.js +3 -6
- package/src/translator/index.js +6 -21
- package/src/translator/tag/attribute/index.js +1 -17
- package/src/translator/tag/attribute-tag.js +4 -11
- package/src/translator/tag/custom-tag.js +1 -2
- package/src/translator/tag/native-tag[html]/index.js +0 -12
- package/src/translator/tag/native-tag[vdom]/index.js +1 -13
- package/src/translator/tag/util.js +69 -55
- package/src/translator/taglib/core/index.js +0 -349
- package/src/translator/util/runtime-flags.js +1 -2
- package/src/translator.js +2 -0
- package/translator/index.d.ts +1 -0
|
@@ -3,21 +3,21 @@ var RenderResult = require("../RenderResult");
|
|
|
3
3
|
var attrsHelper = require("./helpers/attrs");
|
|
4
4
|
var morphdom = require("./morphdom");
|
|
5
5
|
var vdom = require("./vdom");
|
|
6
|
-
var VElement = vdom.
|
|
7
|
-
var VComment = vdom.
|
|
8
|
-
var VDocumentFragment = vdom.
|
|
9
|
-
var VText = vdom.
|
|
10
|
-
var VComponent = vdom.
|
|
11
|
-
var VFragment = vdom.
|
|
12
|
-
var virtualizeHTML = vdom.
|
|
6
|
+
var VElement = vdom.bF_;
|
|
7
|
+
var VComment = vdom.bG_;
|
|
8
|
+
var VDocumentFragment = vdom.bH_;
|
|
9
|
+
var VText = vdom.bI_;
|
|
10
|
+
var VComponent = vdom.bJ_;
|
|
11
|
+
var VFragment = vdom.bK_;
|
|
12
|
+
var virtualizeHTML = vdom.bL_;
|
|
13
13
|
|
|
14
14
|
var EVENT_UPDATE = "update";
|
|
15
15
|
var EVENT_FINISH = "finish";
|
|
16
16
|
|
|
17
17
|
function State(tree) {
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
18
|
+
this.bM_ = new EventEmitter();
|
|
19
|
+
this.bN_ = tree;
|
|
20
|
+
this.bO_ = false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
@@ -33,18 +33,18 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
|
33
33
|
state = new State(parentNode);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
36
|
+
this.bP_ = 1;
|
|
37
|
+
this.bQ_ = 0;
|
|
38
|
+
this.bR_ = null;
|
|
39
|
+
this.bS_ = parentOut;
|
|
40
40
|
|
|
41
41
|
this.data = {};
|
|
42
42
|
this.A_ = state;
|
|
43
43
|
this.ae_ = parentNode;
|
|
44
44
|
this.global = globalData || {};
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
45
|
+
this.bT_ = [parentNode];
|
|
46
|
+
this.bU_ = false;
|
|
47
|
+
this.bV_ = undefined;
|
|
48
48
|
this.b_ = null;
|
|
49
49
|
|
|
50
50
|
this.ac_ = null;
|
|
@@ -53,23 +53,23 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
var proto = AsyncVDOMBuilder.prototype = {
|
|
56
|
-
|
|
56
|
+
bA_: true,
|
|
57
57
|
C_: typeof document === "object" && document,
|
|
58
58
|
|
|
59
59
|
bc: function (component, key, ownerComponent) {
|
|
60
60
|
var vComponent = new VComponent(component, key, ownerComponent);
|
|
61
|
-
return this.
|
|
61
|
+
return this.bW_(vComponent, 0, true);
|
|
62
62
|
},
|
|
63
63
|
|
|
64
64
|
bg_: function (component, key, ownerComponent) {
|
|
65
65
|
var vComponent = new VComponent(component, key, ownerComponent, true);
|
|
66
|
-
this.
|
|
66
|
+
this.bW_(vComponent, 0);
|
|
67
67
|
},
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
this.ae_.
|
|
69
|
+
bW_: function (child, childCount, pushToStack) {
|
|
70
|
+
this.ae_.bX_(child);
|
|
71
71
|
if (pushToStack === true) {
|
|
72
|
-
this.
|
|
72
|
+
this.bT_.push(child);
|
|
73
73
|
this.ae_ = child;
|
|
74
74
|
}
|
|
75
75
|
return childCount === 0 ? this : child;
|
|
@@ -85,7 +85,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
85
85
|
flags,
|
|
86
86
|
props
|
|
87
87
|
);
|
|
88
|
-
return this.
|
|
88
|
+
return this.bW_(element, childCount);
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
bp_: function (tagName, attrs, key, componentDef, props) {
|
|
@@ -103,7 +103,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
103
103
|
n: function (node, component) {
|
|
104
104
|
// NOTE: We do a shallow clone since we assume the node is being reused
|
|
105
105
|
// and a node can only have one parent node.
|
|
106
|
-
var clone = node.
|
|
106
|
+
var clone = node.bY_();
|
|
107
107
|
this.node(clone);
|
|
108
108
|
clone._P_ = component;
|
|
109
109
|
|
|
@@ -111,7 +111,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
111
111
|
},
|
|
112
112
|
|
|
113
113
|
node: function (node) {
|
|
114
|
-
this.ae_.
|
|
114
|
+
this.ae_.bX_(node);
|
|
115
115
|
return this;
|
|
116
116
|
},
|
|
117
117
|
|
|
@@ -130,7 +130,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
130
130
|
text = text.toString();
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
this.ae_.
|
|
133
|
+
this.ae_.bX_(new VText(text, ownerComponent));
|
|
134
134
|
return this;
|
|
135
135
|
},
|
|
136
136
|
|
|
@@ -165,7 +165,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
165
165
|
flags,
|
|
166
166
|
props
|
|
167
167
|
);
|
|
168
|
-
this.
|
|
168
|
+
this.bW_(element, childCount, true);
|
|
169
169
|
return this;
|
|
170
170
|
},
|
|
171
171
|
|
|
@@ -183,7 +183,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
183
183
|
|
|
184
184
|
bf: function (key, component, preserve) {
|
|
185
185
|
var fragment = new VFragment(key, component, preserve);
|
|
186
|
-
this.
|
|
186
|
+
this.bW_(fragment, null, true);
|
|
187
187
|
return this;
|
|
188
188
|
},
|
|
189
189
|
|
|
@@ -192,7 +192,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
192
192
|
},
|
|
193
193
|
|
|
194
194
|
endElement: function () {
|
|
195
|
-
var stack = this.
|
|
195
|
+
var stack = this.bT_;
|
|
196
196
|
stack.pop();
|
|
197
197
|
this.ae_ = stack[stack.length - 1];
|
|
198
198
|
},
|
|
@@ -200,44 +200,44 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
200
200
|
end: function () {
|
|
201
201
|
this.ae_ = undefined;
|
|
202
202
|
|
|
203
|
-
var remaining = --this.
|
|
204
|
-
var parentOut = this.
|
|
203
|
+
var remaining = --this.bP_;
|
|
204
|
+
var parentOut = this.bS_;
|
|
205
205
|
|
|
206
206
|
if (remaining === 0) {
|
|
207
207
|
if (parentOut) {
|
|
208
|
-
parentOut.
|
|
208
|
+
parentOut.bZ_();
|
|
209
209
|
} else {
|
|
210
|
-
this.
|
|
210
|
+
this.c__();
|
|
211
211
|
}
|
|
212
|
-
} else if (remaining - this.
|
|
213
|
-
this.
|
|
212
|
+
} else if (remaining - this.bQ_ === 0) {
|
|
213
|
+
this.ca_();
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
return this;
|
|
217
217
|
},
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
var remaining = --this.
|
|
219
|
+
bZ_: function () {
|
|
220
|
+
var remaining = --this.bP_;
|
|
221
221
|
|
|
222
222
|
if (remaining === 0) {
|
|
223
|
-
var parentOut = this.
|
|
223
|
+
var parentOut = this.bS_;
|
|
224
224
|
if (parentOut) {
|
|
225
|
-
parentOut.
|
|
225
|
+
parentOut.bZ_();
|
|
226
226
|
} else {
|
|
227
|
-
this.
|
|
227
|
+
this.c__();
|
|
228
228
|
}
|
|
229
|
-
} else if (remaining - this.
|
|
230
|
-
this.
|
|
229
|
+
} else if (remaining - this.bQ_ === 0) {
|
|
230
|
+
this.ca_();
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
c__: function () {
|
|
235
235
|
var state = this.A_;
|
|
236
|
-
state.
|
|
237
|
-
state.
|
|
236
|
+
state.bO_ = true;
|
|
237
|
+
state.bM_.emit(EVENT_FINISH, this.n_());
|
|
238
238
|
},
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
ca_: function () {
|
|
241
241
|
var lastArray = this._last;
|
|
242
242
|
|
|
243
243
|
var i = 0;
|
|
@@ -273,7 +273,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
273
273
|
},
|
|
274
274
|
|
|
275
275
|
beginAsync: function (options) {
|
|
276
|
-
if (this.
|
|
276
|
+
if (this.bU_) {
|
|
277
277
|
throw Error(
|
|
278
278
|
"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942)."
|
|
279
279
|
);
|
|
@@ -283,16 +283,16 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
283
283
|
|
|
284
284
|
if (options) {
|
|
285
285
|
if (options.last) {
|
|
286
|
-
this.
|
|
286
|
+
this.bQ_++;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
this.
|
|
290
|
+
this.bP_++;
|
|
291
291
|
|
|
292
|
-
var documentFragment = this.ae_.
|
|
292
|
+
var documentFragment = this.ae_.cb_();
|
|
293
293
|
var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);
|
|
294
294
|
|
|
295
|
-
state.
|
|
295
|
+
state.bM_.emit("beginAsync", {
|
|
296
296
|
out: asyncOut,
|
|
297
297
|
parentOut: this
|
|
298
298
|
});
|
|
@@ -305,7 +305,7 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
305
305
|
},
|
|
306
306
|
|
|
307
307
|
flush: function () {
|
|
308
|
-
var events = this.A_.
|
|
308
|
+
var events = this.A_.bM_;
|
|
309
309
|
|
|
310
310
|
if (events.listenerCount(EVENT_UPDATE)) {
|
|
311
311
|
events.emit(EVENT_UPDATE, new RenderResult(this));
|
|
@@ -313,22 +313,22 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
313
313
|
},
|
|
314
314
|
|
|
315
315
|
ak_: function () {
|
|
316
|
-
return this.A_.
|
|
316
|
+
return this.A_.bN_;
|
|
317
317
|
},
|
|
318
318
|
|
|
319
319
|
n_: function () {
|
|
320
|
-
return this.
|
|
320
|
+
return this.cc_ || (this.cc_ = new RenderResult(this));
|
|
321
321
|
},
|
|
322
322
|
|
|
323
323
|
on: function (event, callback) {
|
|
324
324
|
var state = this.A_;
|
|
325
325
|
|
|
326
|
-
if (event === EVENT_FINISH && state.
|
|
326
|
+
if (event === EVENT_FINISH && state.bO_) {
|
|
327
327
|
callback(this.n_());
|
|
328
328
|
} else if (event === "last") {
|
|
329
329
|
this.onLast(callback);
|
|
330
330
|
} else {
|
|
331
|
-
state.
|
|
331
|
+
state.bM_.on(event, callback);
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
return this;
|
|
@@ -337,19 +337,19 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
337
337
|
once: function (event, callback) {
|
|
338
338
|
var state = this.A_;
|
|
339
339
|
|
|
340
|
-
if (event === EVENT_FINISH && state.
|
|
340
|
+
if (event === EVENT_FINISH && state.bO_) {
|
|
341
341
|
callback(this.n_());
|
|
342
342
|
} else if (event === "last") {
|
|
343
343
|
this.onLast(callback);
|
|
344
344
|
} else {
|
|
345
|
-
state.
|
|
345
|
+
state.bM_.once(event, callback);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
return this;
|
|
349
349
|
},
|
|
350
350
|
|
|
351
351
|
emit: function (type, arg) {
|
|
352
|
-
var events = this.A_.
|
|
352
|
+
var events = this.A_.bM_;
|
|
353
353
|
switch (arguments.length) {
|
|
354
354
|
case 1:
|
|
355
355
|
events.emit(type);
|
|
@@ -365,17 +365,17 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
365
365
|
},
|
|
366
366
|
|
|
367
367
|
removeListener: function () {
|
|
368
|
-
var events = this.A_.
|
|
368
|
+
var events = this.A_.bM_;
|
|
369
369
|
events.removeListener.apply(events, arguments);
|
|
370
370
|
return this;
|
|
371
371
|
},
|
|
372
372
|
|
|
373
373
|
sync: function () {
|
|
374
|
-
this.
|
|
374
|
+
this.bU_ = true;
|
|
375
375
|
},
|
|
376
376
|
|
|
377
377
|
isSync: function () {
|
|
378
|
-
return this.
|
|
378
|
+
return this.bU_;
|
|
379
379
|
},
|
|
380
380
|
|
|
381
381
|
onLast: function (callback) {
|
|
@@ -391,12 +391,12 @@ var proto = AsyncVDOMBuilder.prototype = {
|
|
|
391
391
|
},
|
|
392
392
|
|
|
393
393
|
aj_: function (host) {
|
|
394
|
-
var node = this.
|
|
394
|
+
var node = this.bV_;
|
|
395
395
|
if (!node) {
|
|
396
396
|
var vdomTree = this.ak_();
|
|
397
397
|
|
|
398
398
|
if (!host) host = this.C_;
|
|
399
|
-
this.
|
|
399
|
+
this.bV_ = node = vdomTree.bw_(host, null);
|
|
400
400
|
morphdom(node, vdomTree, host, this.b_);
|
|
401
401
|
}
|
|
402
402
|
return node;
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
var inherit = require("raptor-util/inherit");
|
|
3
3
|
|
|
4
4
|
function VComment(value, ownerComponent) {
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
5
|
+
this.cd_(-1 /* no children */, ownerComponent);
|
|
6
|
+
this.ce_ = value;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
VComment.prototype = {
|
|
10
|
-
|
|
10
|
+
cf_: 8,
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
var nodeValue = this.
|
|
12
|
+
bw_: function (host) {
|
|
13
|
+
var nodeValue = this.ce_;
|
|
14
14
|
return (host.ownerDocument || host).createComment(nodeValue);
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
return new VComment(this.
|
|
17
|
+
bY_: function () {
|
|
18
|
+
return new VComment(this.ce_);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
var VNode = require("./VNode");
|
|
3
3
|
|
|
4
4
|
function VComponent(component, key, ownerComponent, preserve) {
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
5
|
+
this.cd_(null /* childCount */, ownerComponent);
|
|
6
|
+
this.cg_ = key;
|
|
7
7
|
this.s_ = component;
|
|
8
8
|
this.ag_ = preserve;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
VComponent.prototype = {
|
|
12
|
-
|
|
12
|
+
cf_: 2
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
inherit(VComponent, VNode);
|
|
@@ -4,25 +4,25 @@ var VNode = require("./VNode");
|
|
|
4
4
|
|
|
5
5
|
function VDocumentFragmentClone(other) {
|
|
6
6
|
extend(this, other);
|
|
7
|
-
this.cg_ = null;
|
|
8
7
|
this.ch_ = null;
|
|
8
|
+
this.ci_ = null;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function VDocumentFragment(out) {
|
|
12
|
-
this.
|
|
12
|
+
this.cd_(null /* childCount */);
|
|
13
13
|
this.r_ = out;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
VDocumentFragment.prototype = {
|
|
17
|
-
|
|
17
|
+
cf_: 11,
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
cj_: true,
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
bY_: function () {
|
|
22
22
|
return new VDocumentFragmentClone(this);
|
|
23
23
|
},
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
bw_: function (host) {
|
|
26
26
|
return (host.ownerDocument || host).createDocumentFragment();
|
|
27
27
|
}
|
|
28
28
|
};
|
|
@@ -8,7 +8,6 @@ var VNode = require("./VNode");
|
|
|
8
8
|
var isTextOnly = require("./is-text-only");
|
|
9
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
|
10
10
|
var xmlnsRegExp = /^xmlns(:|$)/;
|
|
11
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
12
11
|
var NS_XLINK = "http://www.w3.org/1999/xlink";
|
|
13
12
|
var NS_HTML = "http://www.w3.org/1999/xhtml";
|
|
14
13
|
var NS_MATH = "http://www.w3.org/1998/Math/MathML";
|
|
@@ -19,7 +18,6 @@ var DEFAULT_NS = {
|
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
var FLAG_SIMPLE_ATTRS = 1;
|
|
22
|
-
var FLAG_CUSTOM_ELEMENT = 2;
|
|
23
21
|
var FLAG_SPREAD_ATTRS = 4;
|
|
24
22
|
|
|
25
23
|
var ATTR_HREF = "href";
|
|
@@ -72,26 +70,18 @@ function normalizeValue(value) {
|
|
|
72
70
|
return value + "";
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
function assign(a, b) {
|
|
76
|
-
for (var key in b) {
|
|
77
|
-
if (hasOwnProperty.call(b, key)) {
|
|
78
|
-
a[key] = b[key];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
73
|
function VElementClone(other) {
|
|
84
|
-
this.
|
|
85
|
-
this.cg_ = null;
|
|
74
|
+
this.ck_ = other.ck_;
|
|
86
75
|
this.ch_ = null;
|
|
76
|
+
this.ci_ = null;
|
|
87
77
|
|
|
88
|
-
this.
|
|
89
|
-
this.ck_ = other.ck_;
|
|
90
|
-
this._R_ = other._R_;
|
|
78
|
+
this.cg_ = other.cg_;
|
|
91
79
|
this.cl_ = other.cl_;
|
|
92
|
-
this.
|
|
80
|
+
this._R_ = other._R_;
|
|
93
81
|
this.cm_ = other.cm_;
|
|
82
|
+
this.u_ = other.u_;
|
|
94
83
|
this.cn_ = other.cn_;
|
|
84
|
+
this.co_ = other.co_;
|
|
95
85
|
}
|
|
96
86
|
|
|
97
87
|
function VElement(
|
|
@@ -103,7 +93,7 @@ childCount,
|
|
|
103
93
|
flags,
|
|
104
94
|
props)
|
|
105
95
|
{
|
|
106
|
-
this.
|
|
96
|
+
this.cd_(childCount, ownerComponent);
|
|
107
97
|
|
|
108
98
|
var constId;
|
|
109
99
|
|
|
@@ -111,21 +101,21 @@ props)
|
|
|
111
101
|
constId = props.i;
|
|
112
102
|
}
|
|
113
103
|
|
|
114
|
-
this.
|
|
104
|
+
this.cg_ = key;
|
|
115
105
|
this.u_ = flags || 0;
|
|
116
|
-
this.
|
|
106
|
+
this.cl_ = attrs || EMPTY_OBJECT;
|
|
117
107
|
this._R_ = props || EMPTY_OBJECT;
|
|
118
|
-
this.
|
|
119
|
-
this.
|
|
120
|
-
this.
|
|
108
|
+
this.cm_ = tagName;
|
|
109
|
+
this.cn_ = "";
|
|
110
|
+
this.co_ = constId;
|
|
121
111
|
this.ag_ = false;
|
|
122
112
|
this.af_ = false;
|
|
123
113
|
}
|
|
124
114
|
|
|
125
115
|
VElement.prototype = {
|
|
126
|
-
|
|
116
|
+
cf_: 1,
|
|
127
117
|
|
|
128
|
-
|
|
118
|
+
bY_: function () {
|
|
129
119
|
return new VElementClone(this);
|
|
130
120
|
},
|
|
131
121
|
|
|
@@ -137,7 +127,7 @@ VElement.prototype = {
|
|
|
137
127
|
* @param {int|null} childCount The number of child nodes (or `null` if not known)
|
|
138
128
|
*/
|
|
139
129
|
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
|
140
|
-
var child = this.
|
|
130
|
+
var child = this.bX_(
|
|
141
131
|
new VElement(
|
|
142
132
|
tagName,
|
|
143
133
|
attrs,
|
|
@@ -150,7 +140,7 @@ VElement.prototype = {
|
|
|
150
140
|
);
|
|
151
141
|
|
|
152
142
|
if (childCount === 0) {
|
|
153
|
-
return this.
|
|
143
|
+
return this.cp_();
|
|
154
144
|
} else {
|
|
155
145
|
return child;
|
|
156
146
|
}
|
|
@@ -163,41 +153,36 @@ VElement.prototype = {
|
|
|
163
153
|
* @param {String} value The value for the new Comment node
|
|
164
154
|
*/
|
|
165
155
|
n: function (node, ownerComponent) {
|
|
166
|
-
node = node.
|
|
156
|
+
node = node.bY_();
|
|
167
157
|
node._P_ = ownerComponent;
|
|
168
|
-
this.
|
|
169
|
-
return this.
|
|
158
|
+
this.bX_(node);
|
|
159
|
+
return this.cp_();
|
|
170
160
|
},
|
|
171
161
|
|
|
172
|
-
|
|
173
|
-
var tagName = this.
|
|
174
|
-
var attributes = this.
|
|
162
|
+
bw_: function (host, parentNamespaceURI) {
|
|
163
|
+
var tagName = this.cm_;
|
|
164
|
+
var attributes = this.cl_;
|
|
175
165
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
|
176
166
|
|
|
177
|
-
var flags = this.u_;
|
|
178
167
|
var el = (host.ownerDocument || host).createElementNS(
|
|
179
168
|
namespaceURI,
|
|
180
169
|
tagName
|
|
181
170
|
);
|
|
182
171
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} else {
|
|
186
|
-
for (var attrName in attributes) {
|
|
187
|
-
var attrValue = normalizeValue(attributes[attrName]);
|
|
172
|
+
for (var attrName in attributes) {
|
|
173
|
+
var attrValue = normalizeValue(attributes[attrName]);
|
|
188
174
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
175
|
+
if (attrValue !== undefined) {
|
|
176
|
+
if (attrName == ATTR_XLINK_HREF) {
|
|
177
|
+
el.setAttributeNS(NS_XLINK, ATTR_HREF, attrValue);
|
|
178
|
+
} else {
|
|
179
|
+
el.setAttribute(attrName, attrValue);
|
|
195
180
|
}
|
|
196
181
|
}
|
|
182
|
+
}
|
|
197
183
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
184
|
+
if (isTextOnly(tagName)) {
|
|
185
|
+
el.textContent = this.cn_;
|
|
201
186
|
}
|
|
202
187
|
|
|
203
188
|
vElementByDOMNode.set(el, this);
|
|
@@ -251,7 +236,7 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
|
251
236
|
);
|
|
252
237
|
|
|
253
238
|
if (isTextOnly(tagName)) {
|
|
254
|
-
vdomEl.
|
|
239
|
+
vdomEl.cn_ = node.textContent;
|
|
255
240
|
} else if (virtualizeChildNodes) {
|
|
256
241
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
|
257
242
|
}
|
|
@@ -259,16 +244,12 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
|
259
244
|
return vdomEl;
|
|
260
245
|
}
|
|
261
246
|
|
|
262
|
-
VElement.
|
|
247
|
+
VElement.cq_ = virtualizeElement;
|
|
263
248
|
|
|
264
|
-
VElement.
|
|
249
|
+
VElement.cr_ = function (fromEl, vFromEl, toEl) {
|
|
265
250
|
var fromFlags = vFromEl.u_;
|
|
266
251
|
var toFlags = toEl.u_;
|
|
267
|
-
var attrs = toEl.
|
|
268
|
-
|
|
269
|
-
if (toFlags & FLAG_CUSTOM_ELEMENT) {
|
|
270
|
-
return assign(fromEl, attrs);
|
|
271
|
-
}
|
|
252
|
+
var attrs = toEl.cl_;
|
|
272
253
|
|
|
273
254
|
var props = toEl._R_;
|
|
274
255
|
var attrName;
|
|
@@ -281,7 +262,7 @@ VElement.cq_ = function (fromEl, vFromEl, toEl) {
|
|
|
281
262
|
// real VElement node will not have the expando property
|
|
282
263
|
// so we build the attribute map from the expando property
|
|
283
264
|
|
|
284
|
-
var oldAttrs = vFromEl.
|
|
265
|
+
var oldAttrs = vFromEl.cl_;
|
|
285
266
|
|
|
286
267
|
if (oldAttrs === attrs) {
|
|
287
268
|
// For constant attributes the same object will be provided
|
|
@@ -319,7 +300,7 @@ VElement.cq_ = function (fromEl, vFromEl, toEl) {
|
|
|
319
300
|
}
|
|
320
301
|
|
|
321
302
|
var preserve = props && props.pa || EMPTY_OBJECT;
|
|
322
|
-
var specialAttrs = specialElHandlers[toEl.
|
|
303
|
+
var specialAttrs = specialElHandlers[toEl.cm_] || EMPTY_OBJECT;
|
|
323
304
|
var specialAttr;
|
|
324
305
|
|
|
325
306
|
// Loop over all of the attributes in the attribute map and compare
|
|
@@ -356,7 +337,7 @@ VElement.cq_ = function (fromEl, vFromEl, toEl) {
|
|
|
356
337
|
// was not a virtualized node (i.e., a node that was not rendered by a
|
|
357
338
|
// Marko template, but rather a node that was created from an HTML
|
|
358
339
|
// string or a real DOM node).
|
|
359
|
-
if (toEl.
|
|
340
|
+
if (toEl.cg_ === null || fromFlags & FLAG_SPREAD_ATTRS) {
|
|
360
341
|
for (attrName in oldAttrs) {
|
|
361
342
|
if (!(attrName in attrs)) {
|
|
362
343
|
if (specialAttr = specialAttrs[attrName]) {
|
|
@@ -6,16 +6,16 @@ var createFragmentNode = require("./morphdom/fragment")._m_;
|
|
|
6
6
|
var VNode = require("./VNode");
|
|
7
7
|
|
|
8
8
|
function VFragment(key, ownerComponent, preserve) {
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
9
|
+
this.cd_(null /* childCount */, ownerComponent);
|
|
10
|
+
this.cg_ = key;
|
|
11
11
|
this.ag_ = preserve;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
VFragment.prototype = {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
cf_: 12,
|
|
16
|
+
bw_: function () {
|
|
17
17
|
var fragment = createFragmentNode();
|
|
18
|
-
keysByDOMNode.set(fragment, this.
|
|
18
|
+
keysByDOMNode.set(fragment, this.cg_);
|
|
19
19
|
vElementByDOMNode.set(fragment, this);
|
|
20
20
|
return fragment;
|
|
21
21
|
}
|