* 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)
| 99 | * }|undefined} A URL on the AMP Cache. |
| 100 | */ |
| 101 | function 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 |
no test coverage detected