MCPcopy Create free account
hub / github.com/ampproject/amphtml / hasResolvableActionForTarget

Method hasResolvableActionForTarget

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

* Checks if the given element's registered action resolves to at least one * existing element by id or a global target (e.g. "AMP"). * @param {!Element} element * @param {string} actionEventType * @param {!Element} targetElement * @param {!Element=} opt_stopAt * @return {boolean}

(
    element,
    actionEventType,
    targetElement,
    opt_stopAt
  )

Source from the content-addressed store, hash-verified

522 * @return {boolean}
523 */
524 hasResolvableActionForTarget(
525 element,
526 actionEventType,
527 targetElement,
528 opt_stopAt
529 ) {
530 const action = this.findAction_(element, actionEventType, opt_stopAt);
531 if (!action) {
532 return false;
533 }
534 return action.actionInfos.some((actionInfo) => {
535 const {target} = actionInfo;
536 return this.getActionNode_(target) == targetElement;
537 });
538 }
539
540 /**
541 * For global targets e.g. "AMP", returns the document root. Otherwise,

Callers 3

Calls 2

findAction_Method · 0.95
getActionNode_Method · 0.95

Tested by

no test coverage detected