MCPcopy Index your code
hub / github.com/ampproject/amphtml / getLinkInfo

Function getLinkInfo

ads/alp/handler.js:101–112  ·  view source on GitHub ↗

* For an event, see if there is an anchor tag in the target * ancestor chain and if yes, check whether we can figure * out an AMP target URL. * @param {!Event} e * @return {{ * eventualUrl: (string|undefined), * a: !Element * }|undefined} A URL on the AMP Cache.

(e)

Source from the content-addressed store, hash-verified

99 * }|undefined} A URL on the AMP Cache.
100 */
101function getLinkInfo(e) {
102 const a = closest(dev().assertElement(e.target), (element) => {
103 return element.tagName == 'A' && element.href;
104 });
105 if (!a) {
106 return;
107 }
108 return {
109 eventualUrl: getEventualUrl(a),
110 a,
111 };
112}
113
114/**
115 * Given an anchor tag, figure out whether this goes to an AMP destination

Callers 2

handleClickFunction · 0.85
warmupDynamicFunction · 0.85

Calls 4

closestFunction · 0.90
devFunction · 0.90
getEventualUrlFunction · 0.85
assertElementMethod · 0.80

Tested by

no test coverage detected