marko 5.17.1 → 5.17.2
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.
@@ -1,6 +1,12 @@
|
|
1
1
|
"use strict";var domInsert = require("./dom-insert");
|
2
2
|
|
3
3
|
|
4
|
+
function getRootNode(el) {
|
5
|
+
var cur = el;
|
6
|
+
while (cur.parentNode) cur = cur.parentNode;
|
7
|
+
return cur;
|
8
|
+
}
|
9
|
+
|
4
10
|
function getComponentDefs(result) {
|
5
11
|
var componentDefs = result.b_;
|
6
12
|
|
@@ -97,9 +103,9 @@ Object.defineProperty(proto, "context", {
|
|
97
103
|
domInsert(
|
98
104
|
proto,
|
99
105
|
function getEl(renderResult, referenceEl) {
|
100
|
-
return renderResult.getNode(referenceEl);
|
106
|
+
return renderResult.getNode(getRootNode(referenceEl));
|
101
107
|
},
|
102
108
|
function afterInsert(renderResult, referenceEl) {
|
103
|
-
return renderResult.afterInsert(referenceEl);
|
109
|
+
return renderResult.afterInsert(getRootNode(referenceEl));
|
104
110
|
});
|
105
111
|
//# sourceMappingURL=RenderResult.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/RenderResult.js"],"names":["domInsert","require","getComponentDefs","result","componentDefs","Error","RenderResult","out","undefined","module","exports","proto","prototype","getComponent","getComponents","selector","components","forEach","componentDef","component","push","afterInsert","host","componentsContext","getNode","getOutput","toString","document","window","Object","defineProperty","get","getEl","renderResult","referenceEl"],"mappings":"aAAA,IAAIA,SAAS,GAAGC,OAAO,CAAC,cAAD,CAAvB;;;AAGA,SAASC,gBAAT,CAA0BC,MAA1B,EAAkC;AAChC,MAAIC,aAAa,GAAGD,MAAM,GAA1B;;AAEA,MAAI,CAACC,aAAL,EAAoB;AAClB,UAAMC,KAAK,CAAC,cAAD,CAAX;AACD;AACD,SAAOD,aAAP;AACD;;AAED,SAASE,YAAT,CAAsBC,GAAtB,EAA2B;AACzB,OAAKA,GAAL,GAAW,UA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A,QAAQ,EAAE,OAAOC,MAAP,KAAkB,QAAlB,IAA8BD,QA3CJ,EAAtC;;;AA8CAE,MAAM,CAACC,cAAP,CAAsBnB,KAAtB,EAA6B,MAA7B,EAAqC;AACnCoB,EAAAA,GAAG,EAAE,YAAY;AACf;;;;;;AAMA,WAAO,KAAKL,QAAL,EAAP;AACD,GATkC,EAArC;;;AAYAG,MAAM,CAACC,cAAP,CAAsBnB,KAAtB,EAA6B,SAA7B,EAAwC;AACtCoB,EAAAA,GAAG,EAAE,YAAY;AACf;;;;;;AAMA,WAAO,OAAP;AACD,GATqC,EAAxC;;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;
|
1
|
+
{"version":3,"sources":["../../src/runtime/RenderResult.js"],"names":["domInsert","require","getRootNode","el","cur","parentNode","getComponentDefs","result","componentDefs","Error","RenderResult","out","undefined","module","exports","proto","prototype","getComponent","getComponents","selector","components","forEach","componentDef","component","push","afterInsert","host","componentsContext","getNode","getOutput","toString","document","window","Object","defineProperty","get","getEl","renderResult","referenceEl"],"mappings":"aAAA,IAAIA,SAAS,GAAGC,OAAO,CAAC,cAAD,CAAvB;;;AAGA,SAASC,WAAT,CAAqBC,EAArB,EAAyB;AACvB,MAAIC,GAAG,GAAGD,EAAV;AACA,SAAOC,GAAG,CAACC,UAAX,EAAuBD,GAAG,GAAGA,GAAG,CAACC,UAAV;AACvB,SAAOD,GAAP;AACD;;AAED,SAASE,gBAAT,CAA0BC,MAA1B,EAAkC;AAChC,MAAIC,aAAa,GAAGD,MAAM,GAA1B;;AAEA,MAAI,CAACC,aAAL,EAAoB;AAClB,UAAMC,KAAK,CAAC,cAAD,CAAX;AACD;AACD,SAAOD,aAAP;AACD;;AAED,SAASE,YAAT,CAAsBC,GAAtB,EAA2B;AACzB,OAAKA,GAAL,GAAW,UAAcA,GAAzB;AACA,YAAqBC,SAArB;AACD;;AAEDC,MAAM,CAACC,OAAP,GAAiBJ,YAAjB;;AAEA,IAAIK,KAAK,GAAIL,YAAY,C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AA6B,MAA7B,EAAqC;AACnCoB,EAAAA,GAAG,EAAE,YAAY;AACf;;;;;;AAMA,WAAO,KAAKL,QAAL,EAAP;AACD,GATkC,EAArC;;;AAYAG,MAAM,CAACC,cAAP,CAAsBnB,KAAtB,EAA6B,SAA7B,EAAwC;AACtCoB,EAAAA,GAAG,EAAE,YAAY;AACf;;;;;;AAMA,WAAO,OAAP;AACD,GATqC,EAAxC;;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACAnC,SAAS;AACPe,KADO;AAEP,SAASqB,KAAT,CAAeC,YAAf,EAA6BC,WAA7B,EAA0C;AACxC,SAAOD,YAAY,CAACT,OAAb,CAAqB1B,WAAW,CAACoC,WAAD,CAAhC,CAAP;AACD,CAJM;AAKP,SAASb,WAAT,CAAqBY,YAArB,EAAmCC,WAAnC,EAAgD;AAC9C,SAAOD,YAAY,CAACZ,WAAb,CAAyBvB,WAAW,CAACoC,WAAD,CAApC,CAAP;AACD,CAPM,CAAT","sourcesContent":["var domInsert = require(\"./dom-insert\");\nvar complain = \"MARKO_DEBUG\" && require(\"complain\");\n\nfunction getRootNode(el) {\n var cur = el;\n while (cur.parentNode) cur = cur.parentNode;\n return cur;\n}\n\nfunction getComponentDefs(result) {\n var componentDefs = result.___components;\n\n if (!componentDefs) {\n throw Error(\"No component\");\n }\n return componentDefs;\n}\n\nfunction RenderResult(out) {\n this.out = this.___out = out;\n this.___components = undefined;\n}\n\nmodule.exports = RenderResult;\n\nvar proto = (RenderResult.prototype = {\n getComponent: function () {\n return this.getComponents()[0];\n },\n getComponents: function (selector) {\n if (this.___components === undefined) {\n throw Error(\"Not added to DOM\");\n }\n\n var componentDefs = getComponentDefs(this);\n\n var components = [];\n\n componentDefs.forEach(function (componentDef) {\n var component = componentDef.___component;\n if (!selector || selector(component)) {\n components.push(component);\n }\n });\n\n return components;\n },\n\n afterInsert: function (host) {\n var out = this.___out;\n var componentsContext = out.___components;\n if (componentsContext) {\n this.___components = componentsContext.___initComponents(host);\n } else {\n this.___components = null;\n }\n\n return this;\n },\n getNode: function (host) {\n return this.___out.___getNode(host);\n },\n getOutput: function () {\n return this.___out.___getOutput();\n },\n toString: function () {\n return this.___out.toString();\n },\n document: typeof window === \"object\" && document\n});\n\nObject.defineProperty(proto, \"html\", {\n get: function () {\n // eslint-disable-next-line no-constant-condition\n if (\"MARKO_DEBUG\") {\n complain(\n 'The \"html\" property is deprecated. Please use \"toString\" instead.'\n );\n }\n return this.toString();\n }\n});\n\nObject.defineProperty(proto, \"context\", {\n get: function () {\n // eslint-disable-next-line no-constant-condition\n if (\"MARKO_DEBUG\") {\n complain(\n 'The \"context\" property is deprecated. Please use \"out\" instead.'\n );\n }\n return this.___out;\n }\n});\n\n// Add all of the following DOM methods to Component.prototype:\n// - appendTo(referenceEl)\n// - replace(referenceEl)\n// - replaceChildrenOf(referenceEl)\n// - insertBefore(referenceEl)\n// - insertAfter(referenceEl)\n// - prependTo(referenceEl)\ndomInsert(\n proto,\n function getEl(renderResult, referenceEl) {\n return renderResult.getNode(getRootNode(referenceEl));\n },\n function afterInsert(renderResult, referenceEl) {\n return renderResult.afterInsert(getRootNode(referenceEl));\n }\n);\n"],"file":"RenderResult.js"}
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "5.17.
|
3
|
+
"version": "5.17.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
6
6
|
"dependencies": {
|
7
7
|
"@marko/compiler": "^5.16.1",
|
8
|
-
"@marko/translator-default": "^5.17.
|
8
|
+
"@marko/translator-default": "^5.17.2",
|
9
9
|
"app-module-path": "^2.2.0",
|
10
10
|
"argly": "^1.2.0",
|
11
11
|
"browser-refresh-client": "1.1.4",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"index.js",
|
73
73
|
"node-require.js"
|
74
74
|
],
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "0b6808a6788c181ad190a838097feda108da0125"
|
76
76
|
}
|
@@ -1,6 +1,12 @@
|
|
1
1
|
var domInsert = require("./dom-insert");
|
2
2
|
var complain = "MARKO_DEBUG" && require("complain");
|
3
3
|
|
4
|
+
function getRootNode(el) {
|
5
|
+
var cur = el;
|
6
|
+
while (cur.parentNode) cur = cur.parentNode;
|
7
|
+
return cur;
|
8
|
+
}
|
9
|
+
|
4
10
|
function getComponentDefs(result) {
|
5
11
|
var componentDefs = result.___components;
|
6
12
|
|
@@ -97,9 +103,9 @@ Object.defineProperty(proto, "context", {
|
|
97
103
|
domInsert(
|
98
104
|
proto,
|
99
105
|
function getEl(renderResult, referenceEl) {
|
100
|
-
return renderResult.getNode(referenceEl);
|
106
|
+
return renderResult.getNode(getRootNode(referenceEl));
|
101
107
|
},
|
102
108
|
function afterInsert(renderResult, referenceEl) {
|
103
|
-
return renderResult.afterInsert(referenceEl);
|
109
|
+
return renderResult.afterInsert(getRootNode(referenceEl));
|
104
110
|
}
|
105
111
|
);
|