* @param {!Element} element * @param {!Event} e * @private
(element, e)
| 346 | * @private |
| 347 | */ |
| 348 | handleClick_(element, e) { |
| 349 | this.expandVarsForAnchor_(element); |
| 350 | |
| 351 | let toLocation = this.parseUrl_(element.href); |
| 352 | |
| 353 | // Handle AMP-to-AMP navigation and early-outs, if rel=amphtml. |
| 354 | if (this.handleA2AClick_(e, element, toLocation)) { |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | // Handle navigating to custom protocol and early-outs, if applicable. |
| 359 | if (this.handleCustomProtocolClick_(e, element, toLocation)) { |
| 360 | return; |
| 361 | } |
| 362 | |
| 363 | const fromLocation = this.getLocation_(); |
| 364 | // Only apply anchor mutator if this is an external navigation. |
| 365 | // Note that anchor mutators may theoretically change the navigation |
| 366 | // from external to internal, so we re-parse the new targetLocation |
| 367 | // in handleNavigation_(). |
| 368 | if (getHrefMinusHash(toLocation) != getHrefMinusHash(fromLocation)) { |
| 369 | this.applyAnchorMutators_(element, e); |
| 370 | toLocation = this.parseUrl_(element.href); |
| 371 | } |
| 372 | |
| 373 | // Finally, handle normal click-navigation behavior. |
| 374 | this.handleNavigation_(e, element, toLocation, fromLocation); |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Handles "contextmenu" event e.g. right mouse button click. |
no test coverage detected