marko 5.17.0 → 5.17.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -76,7 +76,7 @@ function addDelegatedEventHandlerToHost(eventType, host) {
|
|
76
76
|
var listeners = host[listenersAttachedKey] =
|
77
77
|
host[listenersAttachedKey] || {};
|
78
78
|
if (!listeners[eventType]) {
|
79
|
-
host.addEventListener(
|
79
|
+
(host.body || host).addEventListener(
|
80
80
|
eventType,
|
81
81
|
listeners[eventType] = function (event) {
|
82
82
|
var propagationStopped = false;
|
@@ -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","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,SA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MAAIA,SAAJ,EAAe;AACbE,IAAAA,UAAU,CAACE,KAAX,CAAiBH,eAAjB,EAAkCD,SAAS,CAACK,MAAV,CAAiBT,KAAjB,EAAwBF,IAAxB,CAAlC;AACD,GAFD,MAEO;AACLQ,IAAAA,UAAU,CAACI,IAAX,CAAgBL,eAAhB,EAAiCL,KAAjC,EAAwCF,IAAxC;AACD;AACF;;AAED,SAASa,wBAAT,CAAkCC,SAAlC,EAA6C;AAC3C,MAAI,CAACxB,eAAe,CAACwB,SAAD,CAApB,EAAiC;AAC/BxB,IAAAA,eAAe,CAACwB,SAAD,CAAf,GAA6B,IAA7B;AACD;AACF;;AAED,SAASC,8BAAT,CAAwCD,SAAxC,EAAmDE,IAAnD,EAAyD;AACvD,MAAIC,SAAS,GAAID,IAAI,CAAC3B,oBAAD,CAAJ;AACf2B,EAAAA,IAAI,CAAC3B,oBAAD,CAAJ,IAA8B,EADhC;AAEA,MAAI,CAAC4B,SAAS,CAACH,SAAD,CAAd,EAA2B;
|
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,IAA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AACT,IAAnB,CAAwBV,KAAxB;AACAkB,QAAAA,kBAAkB,GAAG,IAArB;AACD,OAHD;;AAKA,UAAIG,OAAO,GAAGrB,KAAK,CAACD,MAApB;AACA,UAAI,CAACsB,OAAL,EAAc;AACZ;AACD;;AAEDA,MAAAA,OAAO;AACL;AACA;AACA;AACAA,MAAAA,OAAO,CAACC,uBAAR;;;AAGCD,MAAAA,OAAO,CAACE,QAAR,KAAqBrC,SAArB,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.
|
3
|
+
"version": "5.17.1",
|
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.1",
|
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": "ac32b9545b7243030db23b5ac6f9722beb70cd36"
|
76
76
|
}
|
@@ -76,7 +76,7 @@ function addDelegatedEventHandlerToHost(eventType, host) {
|
|
76
76
|
var listeners = (host[listenersAttachedKey] =
|
77
77
|
host[listenersAttachedKey] || {});
|
78
78
|
if (!listeners[eventType]) {
|
79
|
-
host.addEventListener(
|
79
|
+
(host.body || host).addEventListener(
|
80
80
|
eventType,
|
81
81
|
(listeners[eventType] = function (event) {
|
82
82
|
var propagationStopped = false;
|