v135 · miscellaneous
NavigateEvent sourceElement
When a navigation is initiated by an Element (i.e., a link click or a form submission), the sourceElement property on the NavigateEvent will be the initiating element.
concepts
-
NavigateEvent.sourceElement
Single-link demo: click and watch the property report the originating
<a>. -
Form vs link source
The View-Transitions use case: a real form alongside a list of links;
sourceElementdisambiguates which submit button or anchor fired the nav. -
Navigation source detective
Five different initiators on one page — link, button, form, hash fragment, programmatic
navigation.navigate(). The event log reportssourceElement,navigationType, and target URL for each. -
Navigation Source Logger
Every navigation is intercepted by the Navigation API and its
sourceElementlogged to a table — tag name, id/name, navigation type, and whether it can be intercepted. Includes link clicks, form submits, JSnavigation.navigate(), and syntheticlink.click()calls.
why it shipped
This was requested by web developers. It provides an easy way to disambiguate which of several possible elements initiated a navigation.