Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NavigateEvent.sourceElement #10898

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 45 additions & 19 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -25639,8 +25639,9 @@ document.body.appendChild(wbr);</code></pre>
<li>
<p><span>Navigate</span><!--DONAV hyperlink--> <var>targetNavigable</var> to
<var>urlString</var> using <var>subject</var>'s <span>node document</span>, with <i
data-x="navigation-referrer-policy">referrerPolicy</i> set to <var>referrerPolicy</var> and <i
data-x="navigation-user-involvement">userInvolvement</i> set to <var>userInvolvement</var>.</p>
data-x="navigation-referrer-policy">referrerPolicy</i> set to <var>referrerPolicy</var>, <i
data-x="navigation-user-involvement">userInvolvement</i> set to <var>userInvolvement</var>,
and <i data-x="navigation-source-element">sourceElement</i> set to <var>subject</var>.</p>

<p class="note">Unlike many other types of navigations, following hyperlinks does not have
special "<code data-x="NavigationHistoryBehavior-replace">replace</code>" behavior for when
Expand Down Expand Up @@ -25720,7 +25721,8 @@ document.body.appendChild(wbr);</code></pre>
<var>navigation</var> with <i data-x="fire-navigate-download-destinationURL">destinationURL</i>
set to <var>urlString</var>, <i
data-x="fire-navigate-download-userInvolvement">userInvolvement</i> set to
<var>userInvolvement</var>, and <i data-x="fire-navigate-download-filename">filename</i> set to
<var>userInvolvement</var>, <i data-x="fire-navigate-download-sourceElement">sourceElement</i>
set to <var>subject</var>, and <i data-x="fire-navigate-download-filename">filename</i> set to
<var>filename</var>.</p></li>

<li><p>If <var>continue</var> is false, then return.</p></li>
Expand Down Expand Up @@ -60147,6 +60149,7 @@ fur
using the <code>form</code> element's <span>node document</span>, with <var
data-x="navigation-hh">historyHandling</var> set to <var>historyHandling</var>, <i
data-x="navigation-user-involvement">userInvolvement</i> set to <var>userInvolvement</var>,
<i data-x="navigation-source-element">sourceElement</i> set to <var>submitter</var>,
<i data-x="navigation-referrer-policy">referrerPolicy</i> set to <var>referrerPolicy</var>,
<i data-x="navigation-resource">documentResource</i> set to <var>postResource</var>, and <i
data-x="navigation-form-data-entry-list">formDataEntryList</i> set to <var>entry
Expand Down Expand Up @@ -94869,6 +94872,7 @@ interface <dfn interface>NavigateEvent</dfn> : <span>Event</span> {
readonly attribute DOMString? <span data-x="dom-NavigateEvent-downloadRequest">downloadRequest</span>;
readonly attribute any <span data-x="dom-NavigateEvent-info">info</span>;
readonly attribute boolean <span data-x="dom-NavigateEvent-hasUAVisualTransition">hasUAVisualTransition</span>;
readonly attribute Element? <span data-x="dom-NavigateEvent-sourceElement">sourceElement</span>;

undefined <span data-x="dom-NavigateEvent-intercept">intercept</span>(optional <span>NavigationInterceptOptions</span> options = {});
undefined <span data-x="dom-NavigateEvent-scroll">scroll</span>();
Expand Down Expand Up @@ -94999,6 +95003,11 @@ callback <dfn callback>NavigationInterceptHandler</dfn> = <span data-x="idl-Prom
dispatching this event. If true, the best user experience will be given if the author
synchronously updates the DOM to the post-navigation state.</p></dd>

<dt><code data-x=""><var>event</var>.<span subdfn data-x="dom-NavigateEvent-sourceElement">sourceElement</span></code></dt>
<dd><p>Returns the <code>Element</code> responsible for this navigation, be it an <code>a</code>
element that was clicked, a <span data-x="attr-input-type-submit">Submit Button</span>, or a
noamr marked this conversation as resolved.
Show resolved Hide resolved
submitted <code>form</code>.</p></dd>
noamr marked this conversation as resolved.
Show resolved Hide resolved

<dt><code data-x=""><var>event</var>.<span subdfn data-x="dom-NavigateEvent-intercept">intercept</span>({ <span subdfn data-x="dom-NavigationInterceptOptions-handler">handler</span>, <span subdfn data-x="dom-NavigationInterceptOptions-focusReset">focusReset</span>, <span subdfn data-x="dom-NavigationInterceptOptions-scroll">scroll</span> })</code></dt>
<dd>
<p>Intercepts this navigation, preventing its normal handling and instead converting it into a
Expand Down Expand Up @@ -95103,9 +95112,11 @@ callback <dfn callback>NavigationInterceptHandler</dfn> = <span data-x="idl-Prom
for="NavigateEvent"><code data-x="dom-NavigateEvent-formData">formData</code></dfn>, <dfn
attribute for="NavigateEvent"><code
data-x="dom-NavigateEvent-downloadRequest">downloadRequest</code></dfn>, <dfn attribute
for="NavigateEvent"><code data-x="dom-NavigateEvent-info">info</code></dfn>, and <dfn attribute
for="NavigateEvent"><code data-x="dom-NavigateEvent-info">info</code></dfn>, <dfn attribute
for="NavigateEvent"><code
data-x="dom-NavigateEvent-hasUAVisualTransition">hasUAVisualTransition</code></dfn> attributes
data-x="dom-NavigateEvent-hasUAVisualTransition">hasUAVisualTransition</code></dfn>, and
<dfn attribute for="NavigateEvent"><code
data-x="dom-NavigateEvent-sourceElement">sourceElement</code></dfn> attributes
must return the values they are initialized to.</p>

<p>The <dfn method for="NavigateEvent"><code
Expand Down Expand Up @@ -95418,7 +95429,8 @@ interface <dfn interface>NavigationDestination</dfn> {
<li><p>Return the result of performing the <span>inner <code
data-x="event-navigate">navigate</code> event firing algorithm</span> given
<var>navigation</var>, "<code data-x="dom-NavigationType-traverse">traverse</code>",
<var>event</var>, <var>destination</var>, <var>userInvolvement</var>, null, and null.</p></li>
<var>event</var>, <var>destination</var>, <var>userInvolvement</var>, null, null, and
null.</p></li>
</ol>

<p>To <dfn>fire a push/replace/reload <code data-x="event-navigate">navigate</code> event</dfn> at
Expand All @@ -95428,7 +95440,9 @@ interface <dfn interface>NavigationDestination</dfn> {
data-x="fire-navigate-prr-isSameDocument"><var>isSameDocument</var></dfn>, an optional <span>user
navigation involvement</span> <dfn
data-x="fire-navigate-prr-userInvolvement"><var>userInvolvement</var></dfn> (default "<code
data-x="uni-none">none</code>"), an optional <span>entry list</span>-or-null <dfn
data-x="uni-none">none</code>"), an optional <code>Element</code>-or-null <dfn
data-x="fire-navigate-prr-sourceElement"><var>sourceElement</var></dfn> (default null), an
optional <span>entry list</span>-or-null <dfn
data-x="fire-navigate-prr-formDataEntryList"><var>formDataEntryList</var></dfn> (default null), an
optional <span>serialized state</span> <dfn
data-x="fire-navigate-prr-navigationAPIState"><var>navigationAPIState</var></dfn> (default
Expand Down Expand Up @@ -95466,14 +95480,17 @@ interface <dfn interface>NavigationDestination</dfn> {
<li><p>Return the result of performing the <span>inner <code
data-x="event-navigate">navigate</code> event firing algorithm</span> given
<var>navigation</var>, <var>navigationType</var>, <var>event</var>, <var>destination</var>,
<var>userInvolvement</var>, <var>formDataEntryList</var>, and null.</p></li>
<var>userInvolvement</var>, <var>sourceElement</var>, <var>formDataEntryList</var>, and
null.</p></li>
</ol>

<p>To <dfn>fire a download request <code data-x="event-navigate">navigate</code> event</dfn> at a
<code>Navigation</code> <var>navigation</var> given a <span>URL</span> <dfn
data-x="fire-navigate-download-destinationURL"><var>destinationURL</var></dfn>, a <span>user
navigation involvement</span> <dfn
data-x="fire-navigate-download-userInvolvement"><var>userInvolvement</var></dfn>, and a string
data-x="fire-navigate-download-userInvolvement"><var>userInvolvement</var></dfn>, an
<code>Element</code>-or-null <dfn
data-x="fire-navigate-download-sourceElement"><var>sourceElement</var></dfn>, and a string
<dfn data-x="fire-navigate-download-filename"><var>filename</var></dfn>:</p>

<ol>
Expand Down Expand Up @@ -95505,15 +95522,17 @@ interface <dfn interface>NavigationDestination</dfn> {
<li><p>Return the result of performing the <span>inner <code
data-x="event-navigate">navigate</code> event firing algorithm</span> given
<var>navigation</var>, "<code data-x="dom-NavigationType-push">push</code>", <var>event</var>,
<var>destination</var>, <var>userInvolvement</var>, null, and <var>filename</var>.</p></li>
<var>destination</var>, <var>userInvolvement</var>, <var>sourceElement</var>, null, and
<var>filename</var>.</p></li>
</ol>

<p>The <dfn>inner <code data-x="event-navigate">navigate</code> event firing algorithm</dfn>
consists of the following steps, given a <code>Navigation</code> <var>navigation</var>, a
<code>NavigationType</code> <var>navigationType</var>, a <code>NavigateEvent</code>
<var>event</var>, a <code>NavigationDestination</code> <var>destination</var>, a <span>user
navigation involvement</span> <var>userInvolvement</var>, an <span>entry list</span>-or-null
<var>formDataEntryList</var>, and a string-or-null <var>downloadRequestFilename</var>:</p>
navigation involvement</span> <var>userInvolvement</var>, an <code>Element</code>-or-null
<var>sourceElement</var>, an <span>entry list</span>-or-null <var>formDataEntryList</var>, and a
string-or-null <var>downloadRequestFilename</var>:</p>

<ol>
<li>
Expand Down Expand Up @@ -95635,6 +95654,10 @@ interface <dfn interface>NavigationDestination</dfn> {
transition, to display a cached rendered state of the <var>document</var>'s <span>latest
entry</span>, was done by the user agent. Otherwise, initialize it to false.</p></li>

<li><p>Initialize <var>event</var>'s <code
data-x="dom-NavigateEvent-sourceElement">sourceElement</code> to
<var>sourceElement</var>.</p></li>

<li><p>Set <var>event</var>'s <span data-x="concept-NavigateEvent-abort-controller">abort
controller</span> to a <span>new</span> <code>AbortController</code> created in
<var>navigation</var>'s <span data-x="concept-relevant-realm">relevant realm</span>.</p></li>
Expand Down Expand Up @@ -99849,9 +99872,10 @@ location.href = '#foo';</code></pre>
null <dfn for="navigate" data-x="navigation-form-data-entry-list"
export><var>formDataEntryList</var></dfn> (default null), an optional <span>referrer
policy</span> <dfn data-x="navigation-referrer-policy"><var>referrerPolicy</var></dfn> (default
the empty string), and an optional <span>user navigation involvement</span> <dfn
the empty string), an optional <span>user navigation involvement</span> <dfn
data-x="navigation-user-involvement"><var>userInvolvement</var></dfn> (default "<code
data-x="uni-none">none</code>"):</p>
data-x="uni-none">none</code>"), and an optional <code>Element</code> <dfn
data-x="navigation-source-element"><var>sourceElement</var></dfn> (default null):</p>

<ol>
<li><p>Let <var>cspNavigationType</var> be "<code data-x="">form-submission</code>" if
Expand Down Expand Up @@ -99971,7 +99995,7 @@ location.href = '#foo';</code></pre>
<ol>
<li><p><span data-x="navigate-fragid">Navigate to a fragment</span> given <var>navigable</var>,
<var>url</var>, <var>historyHandling</var>, <var>userInvolvement</var>,
<var>navigationAPIState</var>, and <var>navigationId</var>.</p></li>
<var>sourceElement</var>, <var>navigationAPIState</var>, and <var>navigationId</var>.</p></li>

<li><p>Return.</p></li>
</ol>
Expand Down Expand Up @@ -100074,7 +100098,8 @@ location.href = '#foo';</code></pre>
data-x="fire-navigate-prr-navigationType">navigationType</i> set to <var>historyHandling</var>,
<i data-x="fire-navigate-prr-isSameDocument">isSameDocument</i> set to false, <i
data-x="fire-navigate-prr-userInvolvement">userInvolvement</i> set to
<var>userInvolvement</var>, <i
<var>userInvolvement</var>, <i data-x="fire-navigate-prr-sourceElement">sourceElement</i> set
to <var>sourceElement</var>, <i
data-x="fire-navigate-prr-formDataEntryList">formDataEntryList</i> set to
<var>entryListForFiring</var>, <i data-x="fire-navigate-prr-destinationURL">destinationURL</i>
set to <var>url</var>, and <i
Expand Down Expand Up @@ -100671,8 +100696,8 @@ location.href = '#foo';</code></pre>
<p>To <dfn data-x="navigate-fragid">navigate to a fragment</dfn> given a <span>navigable</span>
<var>navigable</var>, a <span>URL</span> <var>url</var>, a <span>history handling behavior</span>
<var>historyHandling</var>, a <span>user navigation involvement</span> <var>userInvolvement</var>,
a <span>serialized state</span>-or-null <var>navigationAPIState</var>, and a <span>navigation
ID</span> <var>navigationId</var>:</p>
an <code>Element</code>-or-null <var>sourceElement</var>, a <span>serialized state</span>-or-null
<var>navigationAPIState</var>, and a <span>navigation ID</span> <var>navigationId</var>:</p>

<ol>
<li><p>Let <var>navigation</var> be <var>navigable</var>'s <span data-x="nav-window">active
Expand All @@ -100690,7 +100715,8 @@ location.href = '#foo';</code></pre>
<var>navigation</var> with <i data-x="fire-navigate-prr-navigationType">navigationType</i> set to
<var>historyHandling</var>, <i data-x="fire-navigate-prr-isSameDocument">isSameDocument</i> set
to true, <i data-x="fire-navigate-prr-userInvolvement">userInvolvement</i> set to
<var>userInvolvement</var>, <i data-x="fire-navigate-prr-destinationURL">destinationURL</i>
<var>userInvolvement</var>, <i data-x="fire-navigate-prr-sourceElement">sourceElement</i> set
to <var>sourceElement</var>, <i data-x="fire-navigate-prr-destinationURL">destinationURL</i>
set to <var>url</var>, and <i
data-x="fire-navigate-prr-navigationAPIState">navigationAPIState</i> set to
<var>destinationNavigationAPIState</var>.</p></li>
Expand Down