marko 5.17.1 → 5.17.5

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,UAAcA,GAAzB;AACA,YAAqBC,SAArB;AACD;;AAEDC,MAAM,CAACC,OAAP,GAAiBJ,YAAjB;;AAEA,IAAIK,KAAK,GAAIL,YAAY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,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;AACA/B,SAAS;AACPW,KADO;AAEP,SAASqB,KAAT,CAAeC,YAAf,EAA6BC,WAA7B,EAA0C;AACxC,SAAOD,YAAY,CAACT,OAAb,CAAqBU,WAArB,CAAP;AACD,CAJM;AAKP,SAASb,WAAT,CAAqBY,YAArB,EAAmCC,WAAnC,EAAgD;AAC9C,SAAOD,YAAY,CAACZ,WAAb,CAAyBa,WAAzB,CAAP;AACD,CAPM,CAAT","sourcesContent":["var domInsert = require(\"./dom-insert\");\nvar complain = \"MARKO_DEBUG\" && require(\"complain\");\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(referenceEl);\n },\n function afterInsert(renderResult, referenceEl) {\n return renderResult.afterInsert(referenceEl);\n }\n);\n"],"file":"RenderResult.js"}
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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,EAAAA,QAAQ,EAAE,YAAY;AACpB,WAAO,QAAYA,QAAZ,EAAP;AACD,GA1CmC;AA2CpCC,EAAAA,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;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"}
@@ -29,6 +29,7 @@ isImplicitComponent)
29
29
  // On the server
30
30
  if (!componentsContext.p_ && ownerWillRerender) {
31
31
  componentDef._I_ |= FLAG_WILL_RERENDER_IN_BROWSER;
32
+ componentDef._wrr = true;
32
33
  return componentDef;
33
34
  }
34
35
 
@@ -49,6 +50,7 @@ isImplicitComponent)
49
50
 
50
51
  if (isSplitComponent === false && out.global.noBrowserRerender !== true) {
51
52
  componentDef._I_ |= FLAG_WILL_RERENDER_IN_BROWSER;
53
+ componentDef._wrr = true;
52
54
  componentsContext.p_ = false;
53
55
  }
54
56
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtime/components/beginComponent/index.js"],"names":["ComponentDef","require","FLAG_WILL_RERENDER_IN_BROWSER","module","exports","beginComponent","componentsContext","component","key","ownerComponentDef","isSplitComponent","isImplicitComponent","componentId","id","componentDef","ownerIsRenderBoundary","ownerWillRerender","push","out","runtimeId","global","noBrowserRerender","w"],"mappings":"AAAA;;AAEA,MAAMA,YAAY,GAAGC,OAAO,CAAC,iBAAD,CAA5B;;AAEA,IAAIC,6BAA6B,GAAG,CAApC;AACA;;AAEAC,MAAM,CAACC,OAAP,GAAiB,SAASC,cAAT;AACfC,iBADe;AAEfC,SAFe;AAGfC,GAHe;AAIfC,iBAJe;AAKfC,gBALe;AAMfC,mBANe;AAOf;AACA,MAAIC,WAAW,GAAGL,SAAS,CAACM,EAA5B;;AAEA,MAAIC,YAAY,GAAIR,iBAAiB,GAAjB,GAAoC,IAAIN,YAAJ;AACtDO,EAAAA,SADsD;AAEtDK,EAAAA,WAFsD;AAGtDN,EAAAA,iBAHsD,CAAxD;;;AAMA,MAAIS,qBAAqB;AACvBN,EAAAA,iBAAiB,IAAIA,iBAAiB,IADxC;AAEA,MAAIO,iBAAiB;AACnBP,EAAAA,iBAAiB;AACjBA,EAAAA,iBAAiB,IAAjB,GAA6BP,6BAF/B;AAGA;AACA,MAAI,CAACI,iBAAiB,GAAlB,IAAqCU,iBAAzC,EAA4D;AAC1DF,IAAAA,YAAY,IAAZ,IAAyBZ,6BAAzB;AACA,WAAOY,YAAP;AACD;;AAED,MAAIH,mBAAmB,KAAK,IAA5B,EAAkC;AAChC;AACA;AACA;AACA,WAAOG,YAAP;AACD;;AAEDR,EAAAA,iBAAiB,GAAjB,CAAgCW,IAAhC,CAAqCH,YAArC;;AAEA,MAAII,GAAG,GAAGZ,iBAAiB,GAA3B;AACA,MAAIa,SAAS,GAAGD,GAAG,CAACE,MAAJ,CAAWD,SAA3B;;AAEAL,EAAAA,YAAY,IAAZ,GAAiC,IAAjC;AACAA,EAAAA,YAAY,IAAZ,GAAkCR,iBAAiB,GAAnD;;AAEA,MAAII,gBAAgB,KAAK,KAArB,IAA8BQ,GAAG,CAACE,MAAJ,CAAWC,iBAAX,KAAiC,IAAnE,EAAyE;AACvEP,IAAAA,YAAY,IAAZ,IAAyBZ,6BAAzB;AACAI,IAAAA,iBAAiB,GAAjB,GAAmC,KAAnC;AACD;;AAED,MAAI,CAACS,qBAAqB,IAAIC,iBAA1B,KAAgDR,GAAG,IAAI,IAA3D,EAAiE;AAC/DU,IAAAA,GAAG,CAACI,CAAJ;AACE;AACEH,IAAAA,SADF;AAEE,OAFF;AAGEP,IAAAA,WAHF;AAIE,OAJF;AAKEH,IAAAA,iBAAiB,CAACI,EALpB;AAME,OANF;AAOEL,IAAAA,GAPF;AAQE,SATJ;;AAWD,GAZD,MAYO;AACLU,IAAAA,GAAG,CAACI,CAAJ,CAAM,SAASH,SAAT,GAAqB,GAArB,GAA2BP,WAA3B,GAAyC,KAA/C;AACD;;AAED,SAAOE,YAAP;AACD,CAhED","sourcesContent":["\"use strict\";\n\nconst ComponentDef = require(\"../ComponentDef\");\n\nvar FLAG_WILL_RERENDER_IN_BROWSER = 1;\n// var FLAG_HAS_RENDER_BODY = 2;\n\nmodule.exports = function beginComponent(\n componentsContext,\n component,\n key,\n ownerComponentDef,\n isSplitComponent,\n isImplicitComponent\n) {\n var componentId = component.id;\n\n var componentDef = (componentsContext.___componentDef = new ComponentDef(\n component,\n componentId,\n componentsContext\n ));\n\n var ownerIsRenderBoundary =\n ownerComponentDef && ownerComponentDef.___renderBoundary;\n var ownerWillRerender =\n ownerComponentDef &&\n ownerComponentDef.___flags & FLAG_WILL_RERENDER_IN_BROWSER;\n // On the server\n if (!componentsContext.___isPreserved && ownerWillRerender) {\n componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;\n return componentDef;\n }\n\n if (isImplicitComponent === true) {\n // We don't mount implicit components rendered on the server\n // unless the implicit component is nested within a UI component\n // that will re-render in the browser\n return componentDef;\n }\n\n componentsContext.___components.push(componentDef);\n\n let out = componentsContext.___out;\n let runtimeId = out.global.runtimeId;\n\n componentDef.___renderBoundary = true;\n componentDef.___parentPreserved = componentsContext.___isPreserved;\n\n if (isSplitComponent === false && out.global.noBrowserRerender !== true) {\n componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;\n componentsContext.___isPreserved = false;\n }\n\n if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {\n out.w(\n \"<!--\" +\n runtimeId +\n \"^\" +\n componentId +\n \" \" +\n ownerComponentDef.id +\n \" \" +\n key +\n \"-->\"\n );\n } else {\n out.w(\"<!--\" + runtimeId + \"#\" + componentId + \"-->\");\n }\n\n return componentDef;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/runtime/components/beginComponent/index.js"],"names":["ComponentDef","require","FLAG_WILL_RERENDER_IN_BROWSER","module","exports","beginComponent","componentsContext","component","key","ownerComponentDef","isSplitComponent","isImplicitComponent","componentId","id","componentDef","ownerIsRenderBoundary","ownerWillRerender","_wrr","push","out","runtimeId","global","noBrowserRerender","w"],"mappings":"AAAA;;AAEA,MAAMA,YAAY,GAAGC,OAAO,CAAC,iBAAD,CAA5B;;AAEA,IAAIC,6BAA6B,GAAG,CAApC;AACA;;AAEAC,MAAM,CAACC,OAAP,GAAiB,SAASC,cAAT;AACfC,iBADe;AAEfC,SAFe;AAGfC,GAHe;AAIfC,iBAJe;AAKfC,gBALe;AAMfC,mBANe;AAOf;AACA,MAAIC,WAAW,GAAGL,SAAS,CAACM,EAA5B;;AAEA,MAAIC,YAAY,GAAIR,iBAAiB,GAAjB,GAAoC,IAAIN,YAAJ;AACtDO,EAAAA,SADsD;AAEtDK,EAAAA,WAFsD;AAGtDN,EAAAA,iBAHsD,CAAxD;;;AAMA,MAAIS,qBAAqB;AACvBN,EAAAA,iBAAiB,IAA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;;AAED,SAAOE,YAAP;AACD,CAlED","sourcesContent":["\"use strict\";\n\nconst ComponentDef = require(\"../ComponentDef\");\n\nvar FLAG_WILL_RERENDER_IN_BROWSER = 1;\n// var FLAG_HAS_RENDER_BODY = 2;\n\nmodule.exports = function beginComponent(\n componentsContext,\n component,\n key,\n ownerComponentDef,\n isSplitComponent,\n isImplicitComponent\n) {\n var componentId = component.id;\n\n var componentDef = (componentsContext.___componentDef = new ComponentDef(\n component,\n componentId,\n componentsContext\n ));\n\n var ownerIsRenderBoundary =\n ownerComponentDef && ownerComponentDef.___renderBoundary;\n var ownerWillRerender =\n ownerComponentDef &&\n ownerComponentDef.___flags & FLAG_WILL_RERENDER_IN_BROWSER;\n // On the server\n if (!componentsContext.___isPreserved && ownerWillRerender) {\n componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;\n componentDef._wrr = true;\n return componentDef;\n }\n\n if (isImplicitComponent === true) {\n // We don't mount implicit components rendered on the server\n // unless the implicit component is nested within a UI component\n // that will re-render in the browser\n return componentDef;\n }\n\n componentsContext.___components.push(componentDef);\n\n let out = componentsContext.___out;\n let runtimeId = out.global.runtimeId;\n\n componentDef.___renderBoundary = true;\n componentDef.___parentPreserved = componentsContext.___isPreserved;\n\n if (isSplitComponent === false && out.global.noBrowserRerender !== true) {\n componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;\n componentDef._wrr = true;\n componentsContext.___isPreserved = false;\n }\n\n if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {\n out.w(\n \"<!--\" +\n runtimeId +\n \"^\" +\n componentId +\n \" \" +\n ownerComponentDef.id +\n \" \" +\n key +\n \"-->\"\n );\n } else {\n out.w(\"<!--\" + runtimeId + \"#\" + componentId + \"-->\");\n }\n\n return componentDef;\n};\n"],"file":"index.js"}
@@ -99,8 +99,8 @@ function addDelegatedEventHandlerToHost(eventType, host) {
99
99
  // `getAttribute` function in IE 11.
100
100
  // See https://github.com/marko-js/marko/issues/796
101
101
  curNode.correspondingUseElement || (
102
-
103
-
102
+ // in some browsers the event target can be a text node
103
+ // one example being dragenter in firefox.
104
104
  curNode.nodeType === TEXT_NODE ? curNode.parentNode : curNode);
105
105
 
106
106
  // Search up the tree looking DOM events mapped to target
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/components/event-delegation.js"],"names":["componentsUtil","require","runtimeId","componentLookup","getMarkoPropsFromEl","TEXT_NODE","listenersAttachedKey","delegatedEvents","getEventFromEl","el","eventName","virtualProps","eventInfo","split","length","parseInt","delegateEvent","node","target","event","targetMethod","targetComponentId","isOnce","extraArgs","targetComponent","targetFunc","Error","apply","concat","call","addDelegatedEventHandler","eventType","addDelegatedEventHandlerToHost","host","listeners","body","addEventListener","propagationStopped","oldStopPropagation","stopPropagation","curNode","correspondingUseElement","nodeType","parentNode","propName","getAttribute","noop","exports","Object","keys","forEach"],"mappings":"aAAA,IAAIA,cAAc,GAAGC,OAAO,CAAC,QAAD,CAA5B;AACA,IAAIC,SAAS,GAAGF,cAAc,IAA9B;AACA,IAAIG,eAAe,GAAGH,cAAc,GAApC;AACA,IAAII,mBAAmB,GAAGJ,cAAc,IAAxC;;AAEA,IAAIK,SAAS,GAAG,CAAhB;;AAEA;AACA;AACA,IAAIC,oBAAoB,GAAG,SAASJ,SAApC;AACA,IAAIK,eAAe,GAAG,EAAtB;;AAEA,SAASC,cAAT,CAAwBC,EAAxB,EAA4BC,SAA5B,EAAuC;AACrC,MAAIC,YAAY,GAAGP,mBAAmB,CAACK,EAAD,CAAtC;AACA,MAAIG,SAAS,GAAGD,YAAY,CAACD,SAAD,CAA5B;;AAEA,MAAI,OAAOE,SAAP,KAAqB,QAAzB,EAAmC;AACjCA,IAAAA,SAAS,GAAGA,SAAS,CAACC,KAAV,CAAgB,GAAhB,CAAZ;AACA,QAAID,SAAS,CAAC,CAAD,CAAb,EAAkB;AAChBA,MAAAA,SAAS,CAAC,CAAD,CAAT,GAAeA,SAAS,CAAC,CAAD,CAAT,KAAiB,MAA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OAAD,EAAUI,QAAV,CAA5B,EAAkD;AAChD5B,UAAAA,aAAa,CAACwB,OAAD,EAAUI,QAAV,EAAoB1B,MAApB,EAA4BC,KAA5B,CAAb;;AAEA,cAAIkB,kBAAJ,EAAwB;AACtB;AACD;AACF;AACF,OARD,QAQS,CAACG,OAAO,GAAGA,OAAO,CAACG,UAAnB,KAAkCH,OAAO,CAACK,YARnD;AASD,KA5CH;AA6CE,QA7CF;;AA+CD;AACF;;AAED,SAASC,IAAT,GAAgB,CAAE;;AAElBC,OAAO,IAAP,GAA8BD,IAA9B;AACAC,OAAO,IAAP,GAA8BD,IAA9B;AACAC,OAAO,IAAP,GAA2B/B,aAA3B;AACA+B,OAAO,IAAP,GAA4BvC,cAA5B;AACAuC,OAAO,IAAP,GAAsCjB,wBAAtC;AACAiB,OAAO,IAAP,GAAkB,UAAUd,IAAV,EAAgB;AAChCe,EAAAA,MAAM,CAACC,IAAP,CAAY1C,eAAZ,EAA6B2C,OAA7B,CAAqC,UAAUnB,SAAV,EAAqB;AACxDC,IAAAA,8BAA8B,CAACD,SAAD,EAAYE,IAAZ,CAA9B;AACD,GAFD;AAGD,CAJD","sourcesContent":["var componentsUtil = require(\"./util\");\nvar runtimeId = componentsUtil.___runtimeId;\nvar componentLookup = componentsUtil.___componentLookup;\nvar getMarkoPropsFromEl = componentsUtil.___getMarkoPropsFromEl;\n\nvar TEXT_NODE = 3;\n\n// We make our best effort to allow multiple marko runtimes to be loaded in the\n// same window. Each marko runtime will get its own unique runtime ID.\nvar listenersAttachedKey = \"$MDE\" + runtimeId;\nvar delegatedEvents = {};\n\nfunction getEventFromEl(el, eventName) {\n var virtualProps = getMarkoPropsFromEl(el);\n var eventInfo = virtualProps[eventName];\n\n if (typeof eventInfo === \"string\") {\n eventInfo = eventInfo.split(\" \");\n if (eventInfo[2]) {\n eventInfo[2] = eventInfo[2] === \"true\";\n }\n if (eventInfo.length == 4) {\n eventInfo[3] = parseInt(eventInfo[3], 10);\n }\n }\n\n return eventInfo;\n}\n\nfunction delegateEvent(node, eventName, target, event) {\n var targetMethod = target[0];\n var targetComponentId = target[1];\n var isOnce = target[2];\n var extraArgs = target[3];\n\n if (isOnce) {\n var virtualProps = getMarkoPropsFromEl(node);\n delete virtualProps[eventName];\n }\n\n var targetComponent = componentLookup[targetComponentId];\n\n if (!targetComponent) {\n return;\n }\n\n var targetFunc =\n typeof targetMethod === \"function\"\n ? targetMethod\n : targetComponent[targetMethod];\n if (!targetFunc) {\n throw Error(\"Method not found: \" + targetMethod);\n }\n\n if (extraArgs != null) {\n if (typeof extraArgs === \"number\") {\n extraArgs = targetComponent.___bubblingDomEvents[extraArgs];\n }\n }\n\n // Invoke the component method\n if (extraArgs) {\n targetFunc.apply(targetComponent, extraArgs.concat(event, node));\n } else {\n targetFunc.call(targetComponent, event, node);\n }\n}\n\nfunction addDelegatedEventHandler(eventType) {\n if (!delegatedEvents[eventType]) {\n delegatedEvents[eventType] = true;\n }\n}\n\nfunction addDelegatedEventHandlerToHost(eventType, host) {\n var listeners = (host[listenersAttachedKey] =\n host[listenersAttachedKey] || {});\n if (!listeners[eventType]) {\n (host.body || host).addEventListener(\n eventType,\n (listeners[eventType] = function (event) {\n var propagationStopped = false;\n\n // Monkey-patch to fix #97\n var oldStopPropagation = event.stopPropagation;\n\n event.stopPropagation = function () {\n oldStopPropagation.call(event);\n propagationStopped = true;\n };\n\n var curNode = event.target;\n if (!curNode) {\n return;\n }\n\n curNode =\n // event.target of an SVGElementInstance does not have a\n // `getAttribute` function in IE 11.\n // See https://github.com/marko-js/marko/issues/796\n curNode.correspondingUseElement ||\n // in some browsers the event target can be a text node\n // one example being dragenter in firefox.\n (curNode.nodeType === TEXT_NODE ? curNode.parentNode : curNode);\n\n // Search up the tree looking DOM events mapped to target\n // component methods\n var propName = \"on\" + eventType;\n var target;\n\n // Attributes will have the following form:\n // on<event_type>(\"<target_method>|<component_id>\")\n\n do {\n if ((target = getEventFromEl(curNode, propName))) {\n delegateEvent(curNode, propName, target, event);\n\n if (propagationStopped) {\n break;\n }\n }\n } while ((curNode = curNode.parentNode) && curNode.getAttribute);\n }),\n true\n );\n }\n}\n\nfunction noop() {}\n\nexports.___handleNodeAttach = noop;\nexports.___handleNodeDetach = noop;\nexports.___delegateEvent = delegateEvent;\nexports.___getEventFromEl = getEventFromEl;\nexports.___addDelegatedEventHandler = addDelegatedEventHandler;\nexports.___init = function (host) {\n Object.keys(delegatedEvents).forEach(function (eventType) {\n addDelegatedEventHandlerToHost(eventType, host);\n });\n};\n"],"file":"event-delegation.js"}
1
+ {"version":3,"sources":["../../../src/runtime/components/event-delegation.js"],"names":["componentsUtil","require","runtimeId","componentLookup","getMarkoPropsFromEl","TEXT_NODE","listenersAttachedKey","delegatedEvents","getEventFromEl","el","eventName","virtualProps","eventInfo","split","length","parseInt","delegateEvent","node","target","event","targetMethod","targetComponentId","isOnce","extraArgs","targetComponent","targetFunc","Error","apply","concat","call","addDelegatedEventHandler","eventType","addDelegatedEventHandlerToHost","host","listeners","body","addEventListener","propagationStopped","oldStopPropagation","stopPropagation","curNode","correspondingUseElement","nodeType","parentNode","propName","getAttribute","noop","exports","Object","keys","forEach"],"mappings":"aAAA,IAAIA,cAAc,GAAGC,OAAO,CAAC,QAAD,CAA5B;AACA,IAAIC,SAAS,GAAGF,cAAc,IAA9B;AACA,IAAIG,eAAe,GAAGH,cAAc,GAApC;AACA,IAAII,mBAAmB,GAAGJ,cAAc,IAAxC;;AAEA,IAAIK,SAAS,GAAG,CAAhB;;AAEA;AACA;AACA,IAAIC,oBAAoB,GAAG,SAASJ,SAApC;AACA,IAAIK,eAAe,GAAG,EAAtB;;AAEA,SAASC,cAAT,CAAwBC,EAAxB,EAA4BC,SAA5B,EAAuC;AACrC,MAAIC,YAAY,GAAGP,mBAAmB,CAACK,EAAD,CAAtC;AACA,MAAIG,SAAS,GAAGD,YAAY,CAACD,SAAD,CAA5B;;AAEA,MAAI,OAAOE,SAAP,KAAqB,QAAzB,EAAmC;AACjCA,IAAA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,GAAiCmC,OAAO,CAACG,UAAzC,GAAsDH,OAHvD,CAJF;;AASA;AACA;AACA,UAAII,QAAQ,GAAG,OAAOb,SAAtB;AACA,UAAIb,MAAJ;;AAEA;AACA;;AAEA,SAAG;AACD,YAAKA,MAAM,GAAGV,cAAc,CAACgC,OAAD,EAAUI,QAAV,CAA5B,EAAkD;AAChD5B,UAAAA,aAAa,CAACwB,OAAD,EAAUI,QAAV,EAAoB1B,MAApB,EAA4BC,KAA5B,CAAb;;AAEA,cAAIkB,kBAAJ,EAAwB;AACtB;AACD;AACF;AACF,OARD,QAQS,CAACG,OAAO,GAAGA,OAAO,CAACG,UAAnB,KAAkCH,OAAO,CAACK,YARnD;AASD,KA5CH;AA6CE,QA7CF;;AA+CD;AACF;;AAED,SAASC,IAAT,GAAgB,CAAE;;AAElBC,OAAO,IAAP,GAA8BD,IAA9B;AACAC,OAAO,IAAP,GAA8BD,IAA9B;AACAC,OAAO,IAAP,GAA2B/B,aAA3B;AACA+B,OAAO,IAAP,GAA4BvC,cAA5B;AACAuC,OAAO,IAAP,GAAsCjB,wBAAtC;AACAiB,OAAO,IAAP,GAAkB,UAAUd,IAAV,EAAgB;AAChCe,EAAAA,MAAM,CAACC,IAAP,CAAY1C,eAAZ,EAA6B2C,OAA7B,CAAqC,UAAUnB,SAAV,EAAqB;AACxDC,IAAAA,8BAA8B,CAACD,SAAD,EAAYE,IAAZ,CAA9B;AACD,GAFD;AAGD,CAJD","sourcesContent":["var componentsUtil = require(\"./util\");\nvar runtimeId = componentsUtil.___runtimeId;\nvar componentLookup = componentsUtil.___componentLookup;\nvar getMarkoPropsFromEl = componentsUtil.___getMarkoPropsFromEl;\n\nvar TEXT_NODE = 3;\n\n// We make our best effort to allow multiple marko runtimes to be loaded in the\n// same window. Each marko runtime will get its own unique runtime ID.\nvar listenersAttachedKey = \"$MDE\" + runtimeId;\nvar delegatedEvents = {};\n\nfunction getEventFromEl(el, eventName) {\n var virtualProps = getMarkoPropsFromEl(el);\n var eventInfo = virtualProps[eventName];\n\n if (typeof eventInfo === \"string\") {\n eventInfo = eventInfo.split(\" \");\n if (eventInfo[2]) {\n eventInfo[2] = eventInfo[2] === \"true\";\n }\n if (eventInfo.length == 4) {\n eventInfo[3] = parseInt(eventInfo[3], 10);\n }\n }\n\n return eventInfo;\n}\n\nfunction delegateEvent(node, eventName, target, event) {\n var targetMethod = target[0];\n var targetComponentId = target[1];\n var isOnce = target[2];\n var extraArgs = target[3];\n\n if (isOnce) {\n var virtualProps = getMarkoPropsFromEl(node);\n delete virtualProps[eventName];\n }\n\n var targetComponent = componentLookup[targetComponentId];\n\n if (!targetComponent) {\n return;\n }\n\n var targetFunc =\n typeof targetMethod === \"function\"\n ? targetMethod\n : targetComponent[targetMethod];\n if (!targetFunc) {\n throw Error(\"Method not found: \" + targetMethod);\n }\n\n if (extraArgs != null) {\n if (typeof extraArgs === \"number\") {\n extraArgs = targetComponent.___bubblingDomEvents[extraArgs];\n }\n }\n\n // Invoke the component method\n if (extraArgs) {\n targetFunc.apply(targetComponent, extraArgs.concat(event, node));\n } else {\n targetFunc.call(targetComponent, event, node);\n }\n}\n\nfunction addDelegatedEventHandler(eventType) {\n if (!delegatedEvents[eventType]) {\n delegatedEvents[eventType] = true;\n }\n}\n\nfunction addDelegatedEventHandlerToHost(eventType, host) {\n var listeners = (host[listenersAttachedKey] =\n host[listenersAttachedKey] || {});\n if (!listeners[eventType]) {\n (host.body || host).addEventListener(\n eventType,\n (listeners[eventType] = function (event) {\n var propagationStopped = false;\n\n // Monkey-patch to fix #97\n var oldStopPropagation = event.stopPropagation;\n\n event.stopPropagation = function () {\n oldStopPropagation.call(event);\n propagationStopped = true;\n };\n\n var curNode = event.target;\n if (!curNode) {\n return;\n }\n\n curNode =\n // event.target of an SVGElementInstance does not have a\n // `getAttribute` function in IE 11.\n // See https://github.com/marko-js/marko/issues/796\n curNode.correspondingUseElement ||\n // in some browsers the event target can be a text node\n // one example being dragenter in firefox.\n (curNode.nodeType === TEXT_NODE ? curNode.parentNode : curNode);\n\n // Search up the tree looking DOM events mapped to target\n // component methods\n var propName = \"on\" + eventType;\n var target;\n\n // Attributes will have the following form:\n // on<event_type>(\"<target_method>|<component_id>\")\n\n do {\n if ((target = getEventFromEl(curNode, propName))) {\n delegateEvent(curNode, propName, target, event);\n\n if (propagationStopped) {\n break;\n }\n }\n } while ((curNode = curNode.parentNode) && curNode.getAttribute);\n }),\n true\n );\n }\n}\n\nfunction noop() {}\n\nexports.___handleNodeAttach = noop;\nexports.___handleNodeDetach = noop;\nexports.___delegateEvent = delegateEvent;\nexports.___getEventFromEl = getEventFromEl;\nexports.___addDelegatedEventHandler = addDelegatedEventHandler;\nexports.___init = function (host) {\n Object.keys(delegatedEvents).forEach(function (eventType) {\n addDelegatedEventHandlerToHost(eventType, host);\n });\n};\n"],"file":"event-delegation.js"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.17.1",
3
+ "version": "5.17.5",
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
- "@marko/compiler": "^5.16.1",
8
- "@marko/translator-default": "^5.17.1",
7
+ "@marko/compiler": "^5.17.4",
8
+ "@marko/translator-default": "^5.17.5",
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": "ac32b9545b7243030db23b5ac6f9722beb70cd36"
75
+ "gitHead": "c7a2dba4d94136cae5a98d77ed47dbc13b583de8"
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
  );
@@ -29,6 +29,7 @@ module.exports = function beginComponent(
29
29
  // On the server
30
30
  if (!componentsContext.___isPreserved && ownerWillRerender) {
31
31
  componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;
32
+ componentDef._wrr = true;
32
33
  return componentDef;
33
34
  }
34
35
 
@@ -49,6 +50,7 @@ module.exports = function beginComponent(
49
50
 
50
51
  if (isSplitComponent === false && out.global.noBrowserRerender !== true) {
51
52
  componentDef.___flags |= FLAG_WILL_RERENDER_IN_BROWSER;
53
+ componentDef._wrr = true;
52
54
  componentsContext.___isPreserved = false;
53
55
  }
54
56