MCPcopy
hub / github.com/ampproject/amphtml / getActionMap_

Method getActionMap_

src/service/action-impl.js:779–794  ·  view source on GitHub ↗

* @param {!Element} node * @param {string} actionEventType * @return {?{[key: string]: !Array<!ActionInfoDef>}}

(node, actionEventType)

Source from the content-addressed store, hash-verified

777 * @return {?{[key: string]: !Array<!ActionInfoDef>}}
778 */
779 getActionMap_(node, actionEventType) {
780 let actionMap = node[ACTION_MAP_];
781 if (actionMap === undefined) {
782 actionMap = null;
783 if (node.hasAttribute('on')) {
784 const action = node.getAttribute('on');
785 actionMap = parseActionMap(action, node);
786 node[ACTION_MAP_] = actionMap;
787 } else if (node.hasAttribute('execute')) {
788 const action = node.getAttribute('execute');
789 actionMap = parseActionMap(`${actionEventType}:${action}`, node);
790 node[ACTION_MAP_] = actionMap;
791 }
792 }
793 return actionMap;
794 }
795
796 /**
797 * Resets a node's actions with those defined in the given actions string.

Callers 2

matchActionInfos_Method · 0.95
test-action.jsFile · 0.80

Calls 2

parseActionMapFunction · 0.85
getAttributeMethod · 0.80

Tested by

no test coverage detected