marko 5.16.1 → 5.17.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtime/RenderResult.js +13 -11
- package/dist/runtime/RenderResult.js.map +1 -1
- package/dist/runtime/components/Component.js +2 -2
- package/dist/runtime/components/Component.js.map +1 -1
- package/dist/runtime/components/ComponentsContext.js +2 -2
- package/dist/runtime/components/ComponentsContext.js.map +1 -1
- package/dist/runtime/components/event-delegation.js +8 -8
- package/dist/runtime/components/event-delegation.js.map +1 -1
- package/dist/runtime/components/init-components/index-browser.js +22 -24
- package/dist/runtime/components/init-components/index-browser.js.map +1 -1
- package/dist/runtime/components/registry/index-browser.js +2 -2
- package/dist/runtime/components/registry/index-browser.js.map +1 -1
- package/dist/runtime/components/util/index-browser.js +4 -3
- package/dist/runtime/components/util/index-browser.js.map +1 -1
- package/dist/runtime/html/AsyncStream.js +8 -10
- package/dist/runtime/html/AsyncStream.js.map +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -70
- package/dist/runtime/vdom/AsyncVDOMBuilder.js.map +1 -1
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VDocumentFragment.js.map +1 -1
- package/dist/runtime/vdom/VElement.js +42 -39
- package/dist/runtime/vdom/VElement.js.map +1 -1
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +31 -31
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/VText.js.map +1 -1
- package/dist/runtime/vdom/hot-reload.js +5 -5
- package/dist/runtime/vdom/hot-reload.js.map +1 -1
- 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 +30 -30
- package/dist/runtime/vdom/morphdom/index.js.map +1 -1
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +10 -12
- package/dist/runtime/vdom/vdom.js.map +1 -1
- package/package.json +4 -4
- package/src/runtime/RenderResult.js +13 -11
- package/src/runtime/components/Component.js +5 -5
- package/src/runtime/components/ComponentsContext.js +2 -2
- package/src/runtime/components/event-delegation.js +6 -6
- package/src/runtime/components/init-components/index-browser.js +23 -25
- package/src/runtime/components/registry/index-browser.js +3 -3
- package/src/runtime/components/util/index-browser.js +8 -7
- package/src/runtime/html/AsyncStream.js +8 -10
- package/src/runtime/vdom/AsyncVDOMBuilder.js +9 -14
- package/src/runtime/vdom/VDocumentFragment.js +2 -2
- package/src/runtime/vdom/VElement.js +5 -2
- package/src/runtime/vdom/VText.js +2 -2
- package/src/runtime/vdom/hot-reload.js +1 -1
- package/src/runtime/vdom/morphdom/index.js +4 -4
- package/src/runtime/vdom/vdom.js +2 -4
@@ -184,7 +184,7 @@ function Component(id) {
|
|
184
184
|
this.___updateQueued = false;
|
185
185
|
this.___dirty = false;
|
186
186
|
this.___settingInput = false;
|
187
|
-
this.
|
187
|
+
this.___host = undefined;
|
188
188
|
|
189
189
|
var ssrKeyedElements = keyedElementsByComponentId[id];
|
190
190
|
|
@@ -526,21 +526,21 @@ Component.prototype = componentProto = {
|
|
526
526
|
var input = this.___renderInput || this.___input;
|
527
527
|
|
528
528
|
updateManager.___batchUpdate(function () {
|
529
|
-
self.___rerender(input, false).afterInsert(self.
|
529
|
+
self.___rerender(input, false).afterInsert(self.___host);
|
530
530
|
});
|
531
531
|
|
532
532
|
this.___reset();
|
533
533
|
},
|
534
534
|
|
535
535
|
___rerender: function (input, isHydrate) {
|
536
|
-
var
|
536
|
+
var host = this.___host;
|
537
537
|
var globalData = this.___global;
|
538
538
|
var rootNode = this.___rootNode;
|
539
539
|
var renderer = this.___renderer;
|
540
540
|
var createOut = renderer.createOut || defaultCreateOut;
|
541
541
|
var out = createOut(globalData);
|
542
542
|
out.sync();
|
543
|
-
out.
|
543
|
+
out.___host = this.___host;
|
544
544
|
out[CONTEXT_KEY] = this.___context;
|
545
545
|
|
546
546
|
var componentsContext = getComponentsContext(out);
|
@@ -554,7 +554,7 @@ Component.prototype = componentProto = {
|
|
554
554
|
|
555
555
|
var targetNode = out.___getOutput().___firstChild;
|
556
556
|
|
557
|
-
morphdom(rootNode, targetNode,
|
557
|
+
morphdom(rootNode, targetNode, host, componentsContext);
|
558
558
|
|
559
559
|
return result;
|
560
560
|
},
|
@@ -35,10 +35,10 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
ComponentsContext.prototype = {
|
38
|
-
___initComponents: function (
|
38
|
+
___initComponents: function (host) {
|
39
39
|
var componentDefs = this.___components;
|
40
40
|
|
41
|
-
ComponentsContext.___initClientRendered(componentDefs,
|
41
|
+
ComponentsContext.___initClientRendered(componentDefs, host);
|
42
42
|
|
43
43
|
this.___out.emit("___componentsInitialized");
|
44
44
|
|
@@ -72,11 +72,11 @@ function addDelegatedEventHandler(eventType) {
|
|
72
72
|
}
|
73
73
|
}
|
74
74
|
|
75
|
-
function
|
76
|
-
var
|
77
|
-
|
75
|
+
function addDelegatedEventHandlerToHost(eventType, host) {
|
76
|
+
var listeners = (host[listenersAttachedKey] =
|
77
|
+
host[listenersAttachedKey] || {});
|
78
78
|
if (!listeners[eventType]) {
|
79
|
-
body.addEventListener(
|
79
|
+
(host.body || host).addEventListener(
|
80
80
|
eventType,
|
81
81
|
(listeners[eventType] = function (event) {
|
82
82
|
var propagationStopped = false;
|
@@ -133,8 +133,8 @@ exports.___handleNodeDetach = noop;
|
|
133
133
|
exports.___delegateEvent = delegateEvent;
|
134
134
|
exports.___getEventFromEl = getEventFromEl;
|
135
135
|
exports.___addDelegatedEventHandler = addDelegatedEventHandler;
|
136
|
-
exports.___init = function (
|
136
|
+
exports.___init = function (host) {
|
137
137
|
Object.keys(delegatedEvents).forEach(function (eventType) {
|
138
|
-
|
138
|
+
addDelegatedEventHandlerToHost(eventType, host);
|
139
139
|
});
|
140
140
|
};
|
@@ -3,7 +3,6 @@ var complain = "MARKO_DEBUG" && require("complain");
|
|
3
3
|
var warp10Finalize = require("warp10/finalize");
|
4
4
|
var eventDelegation = require("../event-delegation");
|
5
5
|
var win = window;
|
6
|
-
var defaultDocument = document;
|
7
6
|
var createFragmentNode =
|
8
7
|
require("../../vdom/morphdom/fragment").___createFragmentNode;
|
9
8
|
var componentsUtil = require("../util");
|
@@ -168,11 +167,11 @@ function addDOMEventListeners(
|
|
168
167
|
handles.push(removeListener);
|
169
168
|
}
|
170
169
|
|
171
|
-
function initComponent(componentDef,
|
170
|
+
function initComponent(componentDef, host) {
|
172
171
|
var component = componentDef.___component;
|
173
172
|
|
174
173
|
component.___reset();
|
175
|
-
component.
|
174
|
+
component.___host = host;
|
176
175
|
|
177
176
|
var isExisting = componentDef.___isExisting;
|
178
177
|
|
@@ -225,12 +224,11 @@ function initComponent(componentDef, doc) {
|
|
225
224
|
* in the components context (nested components are initialized before ancestor components).
|
226
225
|
* @param {Array<marko-components/lib/ComponentDef>} componentDefs An array of ComponentDef instances
|
227
226
|
*/
|
228
|
-
function initClientRendered(componentDefs,
|
227
|
+
function initClientRendered(componentDefs, host) {
|
228
|
+
if (!host) host = document;
|
229
229
|
// Ensure that event handlers to handle delegating events are
|
230
230
|
// always attached before initializing any components
|
231
|
-
eventDelegation.___init(
|
232
|
-
|
233
|
-
doc = doc || defaultDocument;
|
231
|
+
eventDelegation.___init(host);
|
234
232
|
var len = componentDefs.length;
|
235
233
|
var componentDef;
|
236
234
|
var i;
|
@@ -242,7 +240,7 @@ function initClientRendered(componentDefs, doc) {
|
|
242
240
|
|
243
241
|
for (i = len; i--; ) {
|
244
242
|
componentDef = componentDefs[i];
|
245
|
-
initComponent(componentDef,
|
243
|
+
initComponent(componentDef, host);
|
246
244
|
}
|
247
245
|
}
|
248
246
|
|
@@ -250,7 +248,7 @@ function initClientRendered(componentDefs, doc) {
|
|
250
248
|
* This method initializes all components that were rendered on the server by iterating over all
|
251
249
|
* of the component IDs.
|
252
250
|
*/
|
253
|
-
function initServerRendered(renderedComponents,
|
251
|
+
function initServerRendered(renderedComponents, host) {
|
254
252
|
var type = typeof renderedComponents;
|
255
253
|
var globalKey = "$";
|
256
254
|
var runtimeId;
|
@@ -302,10 +300,10 @@ function initServerRendered(renderedComponents, doc) {
|
|
302
300
|
|
303
301
|
if (isFromSerializedGlobals) {
|
304
302
|
runtimeId = this.r;
|
305
|
-
|
303
|
+
host = document;
|
306
304
|
} else {
|
307
305
|
runtimeId = renderedComponents.r || DEFAULT_RUNTIME_ID;
|
308
|
-
|
306
|
+
if (!host) host = document;
|
309
307
|
|
310
308
|
// eslint-disable-next-line no-constant-condition
|
311
309
|
if ("MARKO_DEBUG") {
|
@@ -317,7 +315,7 @@ function initServerRendered(renderedComponents, doc) {
|
|
317
315
|
|
318
316
|
// eslint-disable-next-line no-constant-condition
|
319
317
|
if ("MARKO_DEBUG") {
|
320
|
-
if (
|
318
|
+
if (host !== document) {
|
321
319
|
complain(
|
322
320
|
"Passing a document other than the current document to `require('marko/components).init` is deprecated."
|
323
321
|
);
|
@@ -342,8 +340,8 @@ function initServerRendered(renderedComponents, doc) {
|
|
342
340
|
|
343
341
|
// Ensure that event handlers to handle delegating events are
|
344
342
|
// always attached before initializing any components
|
345
|
-
indexServerComponentBoundaries(
|
346
|
-
eventDelegation.___init(
|
343
|
+
indexServerComponentBoundaries(host, runtimeId);
|
344
|
+
eventDelegation.___init(host);
|
347
345
|
|
348
346
|
if (renderedComponents.g) {
|
349
347
|
meta.___globals = renderedComponents.g;
|
@@ -362,12 +360,12 @@ function initServerRendered(renderedComponents, doc) {
|
|
362
360
|
var typeName = meta.___types[componentDef[1]];
|
363
361
|
|
364
362
|
return registry.___isRegistered(typeName)
|
365
|
-
? tryHydrateComponent(componentDef, meta,
|
363
|
+
? tryHydrateComponent(componentDef, meta, host, runtimeId)
|
366
364
|
: registry.___addPendingDef(
|
367
365
|
componentDef,
|
368
366
|
typeName,
|
369
367
|
meta,
|
370
|
-
|
368
|
+
host,
|
371
369
|
runtimeId
|
372
370
|
);
|
373
371
|
})
|
@@ -377,14 +375,14 @@ function initServerRendered(renderedComponents, doc) {
|
|
377
375
|
return this;
|
378
376
|
}
|
379
377
|
|
380
|
-
function tryHydrateComponent(rawDef, meta,
|
378
|
+
function tryHydrateComponent(rawDef, meta, host, runtimeId) {
|
381
379
|
var componentDef = ComponentDef.___deserialize(
|
382
380
|
rawDef,
|
383
381
|
meta.___types,
|
384
382
|
meta.___globals,
|
385
383
|
registry
|
386
384
|
);
|
387
|
-
var mount = hydrateComponentAndGetMount(componentDef,
|
385
|
+
var mount = hydrateComponentAndGetMount(componentDef, host);
|
388
386
|
|
389
387
|
if (!mount) {
|
390
388
|
// hydrateComponentAndGetMount will return false if there is not rootNode
|
@@ -394,11 +392,11 @@ function tryHydrateComponent(rawDef, meta, doc, runtimeId) {
|
|
394
392
|
deferredDefs.push(componentDef);
|
395
393
|
} else {
|
396
394
|
deferredDefs = [componentDef];
|
397
|
-
|
398
|
-
indexServerComponentBoundaries(
|
395
|
+
document.addEventListener("DOMContentLoaded", function () {
|
396
|
+
indexServerComponentBoundaries(host, runtimeId);
|
399
397
|
deferredDefs
|
400
398
|
.map(function (componentDef) {
|
401
|
-
return hydrateComponentAndGetMount(componentDef,
|
399
|
+
return hydrateComponentAndGetMount(componentDef, host);
|
402
400
|
})
|
403
401
|
.reverse()
|
404
402
|
.forEach(tryInvoke);
|
@@ -410,7 +408,7 @@ function tryHydrateComponent(rawDef, meta, doc, runtimeId) {
|
|
410
408
|
return mount;
|
411
409
|
}
|
412
410
|
|
413
|
-
function hydrateComponentAndGetMount(componentDef,
|
411
|
+
function hydrateComponentAndGetMount(componentDef, host) {
|
414
412
|
var componentId = componentDef.id;
|
415
413
|
var component = componentDef.___component;
|
416
414
|
var rootNode = serverComponentRootNodes[componentId];
|
@@ -423,18 +421,18 @@ function hydrateComponentAndGetMount(componentDef, doc) {
|
|
423
421
|
componentsByDOMNode.set(rootNode, component);
|
424
422
|
|
425
423
|
if (componentDef.___flags & FLAG_WILL_RERENDER_IN_BROWSER) {
|
426
|
-
component.
|
424
|
+
component.___host = host;
|
427
425
|
renderResult = component.___rerender(component.___input, true);
|
428
426
|
trackComponent(componentDef);
|
429
427
|
return function mount() {
|
430
|
-
renderResult.afterInsert(
|
428
|
+
renderResult.afterInsert(host);
|
431
429
|
};
|
432
430
|
} else {
|
433
431
|
trackComponent(componentDef);
|
434
432
|
}
|
435
433
|
|
436
434
|
return function mount() {
|
437
|
-
initComponent(componentDef,
|
435
|
+
initComponent(componentDef, host);
|
438
436
|
};
|
439
437
|
}
|
440
438
|
}
|
@@ -35,13 +35,13 @@ function register(type, def) {
|
|
35
35
|
return type;
|
36
36
|
}
|
37
37
|
|
38
|
-
function addPendingDef(def, type, meta,
|
38
|
+
function addPendingDef(def, type, meta, host, runtimeId) {
|
39
39
|
if (!pendingDefs) {
|
40
40
|
pendingDefs = {};
|
41
41
|
|
42
42
|
// eslint-disable-next-line no-constant-condition
|
43
43
|
if ("MARKO_DEBUG") {
|
44
|
-
|
44
|
+
document.addEventListener("load", function () {
|
45
45
|
var pendingComponentIds = Object.keys(pendingDefs);
|
46
46
|
if (pendingComponentIds.length) {
|
47
47
|
complain(
|
@@ -54,7 +54,7 @@ function addPendingDef(def, type, meta, doc, runtimeId) {
|
|
54
54
|
(pendingDefs[type] = pendingDefs[type] || []).push([
|
55
55
|
def,
|
56
56
|
meta,
|
57
|
-
|
57
|
+
host,
|
58
58
|
runtimeId
|
59
59
|
]);
|
60
60
|
}
|
@@ -8,12 +8,13 @@ var runtimeId = markoUID.i++;
|
|
8
8
|
|
9
9
|
var componentLookup = {};
|
10
10
|
|
11
|
-
var defaultDocument = document;
|
12
11
|
var EMPTY_OBJECT = {};
|
13
12
|
|
14
|
-
function getComponentForEl(el,
|
13
|
+
function getComponentForEl(el, host) {
|
15
14
|
var node =
|
16
|
-
typeof el == "string"
|
15
|
+
typeof el == "string"
|
16
|
+
? ((host ? host.ownerDocument : host) || document).getElementById(el)
|
17
|
+
: el;
|
17
18
|
var component;
|
18
19
|
var vElement;
|
19
20
|
|
@@ -158,11 +159,11 @@ if ("MARKO_DEBUG") {
|
|
158
159
|
};
|
159
160
|
}
|
160
161
|
};
|
161
|
-
exports.___startDOMManipulationWarning = function () {
|
162
|
-
|
162
|
+
exports.___startDOMManipulationWarning = function (host) {
|
163
|
+
host.addEventListener("DOMNodeRemoved", warnNodeRemoved);
|
163
164
|
};
|
164
|
-
exports.___stopDOMManipulationWarning = function () {
|
165
|
-
|
165
|
+
exports.___stopDOMManipulationWarning = function (host) {
|
166
|
+
host.removeEventListener("DOMNodeRemoved", warnNodeRemoved);
|
166
167
|
};
|
167
168
|
}
|
168
169
|
|
@@ -2,7 +2,6 @@
|
|
2
2
|
var EventEmitter = require("events-light");
|
3
3
|
var StringWriter = require("./StringWriter");
|
4
4
|
var BufferedWriter = require("./BufferedWriter");
|
5
|
-
var defaultDocument = typeof document != "undefined" && document;
|
6
5
|
var RenderResult = require("../RenderResult");
|
7
6
|
var attrsHelper = require("./helpers/attrs");
|
8
7
|
var markoAttr = require("./helpers/data-marko");
|
@@ -115,7 +114,7 @@ AsyncStream.enableAsyncStackTrace = function () {
|
|
115
114
|
|
116
115
|
var proto = (AsyncStream.prototype = {
|
117
116
|
constructor: AsyncStream,
|
118
|
-
|
117
|
+
___host: typeof window === "object" && document,
|
119
118
|
___isOut: true,
|
120
119
|
|
121
120
|
sync: function () {
|
@@ -603,17 +602,16 @@ var proto = (AsyncStream.prototype = {
|
|
603
602
|
}
|
604
603
|
},
|
605
604
|
|
606
|
-
___getNode: function (
|
605
|
+
___getNode: function (host) {
|
607
606
|
var node = this._node;
|
608
|
-
var nextEl;
|
609
|
-
var fragment;
|
610
|
-
var html = this.___getOutput();
|
611
|
-
|
612
|
-
if (!doc) {
|
613
|
-
doc = this.___document;
|
614
|
-
}
|
615
607
|
|
616
608
|
if (!node) {
|
609
|
+
var nextEl;
|
610
|
+
var fragment;
|
611
|
+
var html = this.___getOutput();
|
612
|
+
if (!host) host = this.___host;
|
613
|
+
var doc = host.ownerDocument || host;
|
614
|
+
|
617
615
|
if (html) {
|
618
616
|
node = parseHTML(html);
|
619
617
|
|
@@ -7,7 +7,6 @@ var VComponent = vdom.___VComponent;
|
|
7
7
|
var VFragment = vdom.___VFragment;
|
8
8
|
var virtualizeHTML = vdom.___virtualizeHTML;
|
9
9
|
var RenderResult = require("../RenderResult");
|
10
|
-
var defaultDocument = vdom.___defaultDocument;
|
11
10
|
var morphdom = require("./morphdom");
|
12
11
|
var attrsHelper = require("./helpers/attrs");
|
13
12
|
|
@@ -54,7 +53,7 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
54
53
|
|
55
54
|
var proto = (AsyncVDOMBuilder.prototype = {
|
56
55
|
___isOut: true,
|
57
|
-
|
56
|
+
___host: typeof window === "object" && document,
|
58
57
|
|
59
58
|
bc: function (component, key, ownerComponent) {
|
60
59
|
var vComponent = new VComponent(component, key, ownerComponent);
|
@@ -136,11 +135,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
136
135
|
|
137
136
|
html: function (html, ownerComponent) {
|
138
137
|
if (html != null) {
|
139
|
-
var vdomNode = virtualizeHTML(
|
140
|
-
html,
|
141
|
-
this.___document || document,
|
142
|
-
ownerComponent
|
143
|
-
);
|
138
|
+
var vdomNode = virtualizeHTML(html, ownerComponent);
|
144
139
|
this.node(vdomNode);
|
145
140
|
}
|
146
141
|
|
@@ -389,20 +384,20 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
389
384
|
return this;
|
390
385
|
},
|
391
386
|
|
392
|
-
___getNode: function (
|
387
|
+
___getNode: function (host) {
|
393
388
|
var node = this.___vnode;
|
394
389
|
if (!node) {
|
395
390
|
var vdomTree = this.___getOutput();
|
396
|
-
|
397
|
-
|
398
|
-
this.___vnode = node = vdomTree.___actualize(
|
399
|
-
morphdom(node, vdomTree,
|
391
|
+
|
392
|
+
if (!host) host = this.___host;
|
393
|
+
this.___vnode = node = vdomTree.___actualize(host, null);
|
394
|
+
morphdom(node, vdomTree, host, this.___components);
|
400
395
|
}
|
401
396
|
return node;
|
402
397
|
},
|
403
398
|
|
404
|
-
toString: function (
|
405
|
-
var docFragment = this.___getNode(
|
399
|
+
toString: function (host) {
|
400
|
+
var docFragment = this.___getNode(host);
|
406
401
|
var html = "";
|
407
402
|
|
408
403
|
var child = docFragment.firstChild;
|
@@ -22,8 +22,8 @@ VDocumentFragment.prototype = {
|
|
22
22
|
return new VDocumentFragmentClone(this);
|
23
23
|
},
|
24
24
|
|
25
|
-
___actualize: function (
|
26
|
-
return
|
25
|
+
___actualize: function (host) {
|
26
|
+
return (host.ownerDocument || host).createDocumentFragment();
|
27
27
|
}
|
28
28
|
};
|
29
29
|
|
@@ -151,13 +151,16 @@ VElement.prototype = {
|
|
151
151
|
return this.___finishChild();
|
152
152
|
},
|
153
153
|
|
154
|
-
___actualize: function (
|
154
|
+
___actualize: function (host, parentNamespaceURI) {
|
155
155
|
var tagName = this.___nodeName;
|
156
156
|
var attributes = this.___attributes;
|
157
157
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
158
158
|
|
159
159
|
var flags = this.___flags;
|
160
|
-
var el =
|
160
|
+
var el = (host.ownerDocument || host).createElementNS(
|
161
|
+
namespaceURI,
|
162
|
+
tagName
|
163
|
+
);
|
161
164
|
|
162
165
|
if (flags & FLAG_CUSTOM_ELEMENT) {
|
163
166
|
assign(el, attributes);
|
@@ -11,8 +11,8 @@ VText.prototype = {
|
|
11
11
|
|
12
12
|
___nodeType: 3,
|
13
13
|
|
14
|
-
___actualize: function (
|
15
|
-
return
|
14
|
+
___actualize: function (host) {
|
15
|
+
return (host.ownerDocument || host).createTextNode(this.___nodeValue);
|
16
16
|
},
|
17
17
|
|
18
18
|
___cloneNode: function () {
|
@@ -56,7 +56,7 @@ function onNodeAdded(node, componentsContext) {
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
-
function morphdom(fromNode, toNode,
|
59
|
+
function morphdom(fromNode, toNode, host, componentsContext) {
|
60
60
|
var globalComponentsContext;
|
61
61
|
var isHydrate = false;
|
62
62
|
var keySequences = Object.create(null);
|
@@ -74,7 +74,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
74
74
|
ownerComponent,
|
75
75
|
parentComponent
|
76
76
|
) {
|
77
|
-
var realNode = vNode.___actualize(
|
77
|
+
var realNode = vNode.___actualize(host, parentEl.namespaceURI);
|
78
78
|
insertBefore(realNode, referenceEl, parentEl);
|
79
79
|
|
80
80
|
if (
|
@@ -678,7 +678,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
678
678
|
|
679
679
|
// eslint-disable-next-line no-constant-condition
|
680
680
|
if ("MARKO_DEBUG") {
|
681
|
-
componentsUtil.___stopDOMManipulationWarning();
|
681
|
+
componentsUtil.___stopDOMManipulationWarning(host);
|
682
682
|
}
|
683
683
|
|
684
684
|
morphChildren(fromNode, toNode, toNode.___component);
|
@@ -707,7 +707,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
707
707
|
|
708
708
|
// eslint-disable-next-line no-constant-condition
|
709
709
|
if ("MARKO_DEBUG") {
|
710
|
-
componentsUtil.___startDOMManipulationWarning();
|
710
|
+
componentsUtil.___startDOMManipulationWarning(host);
|
711
711
|
}
|
712
712
|
}
|
713
713
|
|
package/src/runtime/vdom/vdom.js
CHANGED
@@ -6,7 +6,6 @@ var VComponent = require("./VComponent");
|
|
6
6
|
var VFragment = require("./VFragment");
|
7
7
|
var parseHTML = require("./parse-html");
|
8
8
|
|
9
|
-
var defaultDocument = typeof document != "undefined" && document;
|
10
9
|
var specialHtmlRegexp = /[&<]/;
|
11
10
|
|
12
11
|
function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
@@ -30,7 +29,7 @@ function virtualize(node, ownerComponent) {
|
|
30
29
|
}
|
31
30
|
}
|
32
31
|
|
33
|
-
function virtualizeHTML(html,
|
32
|
+
function virtualizeHTML(html, ownerComponent) {
|
34
33
|
if (!specialHtmlRegexp.test(html)) {
|
35
34
|
return new VText(html, ownerComponent);
|
36
35
|
}
|
@@ -61,7 +60,7 @@ Node_prototype.t = function (value) {
|
|
61
60
|
value = "";
|
62
61
|
} else if (type === "object") {
|
63
62
|
if (value.toHTML) {
|
64
|
-
vdomNode = virtualizeHTML(value.toHTML()
|
63
|
+
vdomNode = virtualizeHTML(value.toHTML());
|
65
64
|
}
|
66
65
|
}
|
67
66
|
}
|
@@ -81,4 +80,3 @@ exports.___VComponent = VComponent;
|
|
81
80
|
exports.___VFragment = VFragment;
|
82
81
|
exports.___virtualize = virtualize;
|
83
82
|
exports.___virtualizeHTML = virtualizeHTML;
|
84
|
-
exports.___defaultDocument = defaultDocument;
|