Skip to content

Commit

Permalink
Merge branch 'whatwg:main' into nrr-add
Browse files Browse the repository at this point in the history
  • Loading branch information
rubberyuzu committed May 13, 2024
2 parents 84bbc6b + f239744 commit e516a82
Showing 1 changed file with 72 additions and 64 deletions.
136 changes: 72 additions & 64 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -61482,10 +61482,12 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<span>this</span>'s <span>relevant global object</span>, with:</p>

<ul>
<li><p><i data-x="create-close-watcher-cancelAction">cancelAction</i> being to return the
result of <span data-x="concept-event-fire">firing an event</span> named <code
<li><p><i data-x="create-close-watcher-cancelAction">cancelAction</i> given
<var>canPreventClose</var> being to return the result of <span
data-x="concept-event-fire">firing an event</span> named <code
data-x="event-cancel">cancel</code> at <span>this</span>, with the <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to
<var>canPreventClose</var>.</p></li>

<li><p><i data-x="create-close-watcher-closeAction">closeAction</i> being to <span>close the
dialog</span> given <span>this</span> and null.</p></li>
Expand Down Expand Up @@ -82182,13 +82184,16 @@ body { display:none }
<ul>
<li><p>A <dfn data-x="close-watcher-window">window</dfn>, a <code>Window</code>.</p></li>

<li><p>A <dfn data-x="close-watcher-cancel-action">cancel action</dfn>, a list of steps. These
steps can never throw an exception, and return either true (to indicate that the caller will
proceed to the <span data-x="close-watcher-close-action">close action</span>) or false (to
indicate that the caller will bail out).</p></li>
<li><p>A <dfn data-x="close-watcher-cancel-action">cancel action</dfn>, an algorithm accepting a
boolean argument and returning a boolean. The argument indicates whether or not the cancel
action algorithm can prevent the close request from proceeding via the algorithm's return value.
If the boolean argument is true, then the algorithm can return either true to indicate that the
caller will proceed to the <span data-x="close-watcher-close-action">close action</span>, or
false to indicate that the caller will bail out. If the argument is false, then the return value
is always false. This algorithm can never throw an exception.</p></li>

<li><p>A <dfn data-x="close-watcher-close-action">close action</dfn>, a list of steps. These
steps can never throw an exception.</p></li>
<li><p>A <dfn data-x="close-watcher-close-action">close action</dfn>, an algorithm accepting no
arguments and returning nothing. This algorithm can never throw an exception.</p></li>

<li><p>An <dfn data-x="close-watcher-is-running-cancel">is running cancel action</dfn>
boolean.</p></li>
Expand Down Expand Up @@ -82273,38 +82278,37 @@ body { display:none }
<li><p>If <var>window</var>'s <span data-x="concept-document-window">associated
<code>Document</code></span> is not <span>fully active</span>, then return true.</p></li>

<li>
<p>If <var>window</var>'s <span>close watcher manager</span>'s <span data-x="close watcher
manager groups">groups</span>'s <span data-x="list size">size</span> is less than
<var>window</var>'s <span>close watcher manager</span>'s <span data-x="close watcher manager
allowed number of groups">allowed number of groups</span>, and <var>window</var> has
<span>history-action activation</span>, then:</p>
<li><p>Let <var>canPreventClose</var> be true if <var>window</var>'s <span>close watcher
manager</span>'s <span data-x="close watcher manager groups">groups</span>'s <span data-x="list
size">size</span> is less than <var>window</var>'s <span>close watcher manager</span>'s <span
data-x="close watcher manager allowed number of groups">allowed number of groups</span>, and
<var>window</var> has <span>history-action activation</span>; otherwise false.</p></li>

<ol>
<li><p>Set <var>closeWatcher</var>'s <span data-x="close-watcher-is-running-cancel">is running
cancel action</span> to true.</p></li>
<li><p>Set <var>closeWatcher</var>'s <span data-x="close-watcher-is-running-cancel">is running
cancel action</span> to true.</p></li>

<li><p>Let <var>shouldContinue</var> be the result of running <var>closeWatcher</var>'s <span
data-x="close-watcher-cancel-action">cancel action</span>.</p></li>
<li><p>Let <var>shouldContinue</var> be the result of running <var>closeWatcher</var>'s <span
data-x="close-watcher-cancel-action">cancel action</span> given
<var>canPreventClose</var>.</p></li>

<li><p>Set <var>closeWatcher</var>'s <span data-x="close-watcher-is-running-cancel">is running
cancel action</span> to false.</p></li>
<li><p>Set <var>closeWatcher</var>'s <span data-x="close-watcher-is-running-cancel">is running
cancel action</span> to false.</p></li>

<li>
<p>If <var>shouldContinue</var> is false, then:</p>
<li>
<p>If <var>shouldContinue</var> is false, then:</p>

<ol>
<li><p><span>Consume history-action user activation</span> given <var>window</var>.</p></li>
<ol>
<li><p><span>Assert</span>: <var>canPreventClose</var> is true.</p></li>

<li><p>Return false.</p></li>
</ol>
</li>
<li><p><span>Consume history-action user activation</span> given <var>window</var>.</p></li>

<li><p>Return false.</p></li>
</ol>

<p class="note">Note that since these substeps <span>consume history-action user
activation</span>, <span data-x="close-watcher-request-close">requesting to close</span> a
<span>close watcher</span> twice without any intervening <span>user activation</span> will skip
these substeps.</p>
<span>close watcher</span> twice without any intervening <span>user activation</span> will
result in <var>canPreventClose</var> being false the second time.</p>
</li>

<li><p><span data-x="close-watcher-close">Close</span> <var>closeWatcher</var>.</p></li>
Expand Down Expand Up @@ -82481,10 +82485,12 @@ dictionary <dfn dictionary>CloseWatcherOptions</dfn> {
object</span>, with:</p>

<ul>
<li><p><i data-x="create-close-watcher-cancelAction">cancelAction</i> being to return the
result of <span data-x="concept-event-fire">firing an event</span> named <code
<li><p><i data-x="create-close-watcher-cancelAction">cancelAction</i> given
<var>canPreventClose</var> being to return the result of <span
data-x="concept-event-fire">firing an event</span> named <code
data-x="event-cancel">cancel</code> at <span>this</span>, with the <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to
<var>canPreventClose</var>.</p></li>

<li><p><i data-x="create-close-watcher-closeAction">closeAction</i> being to <span
data-x="concept-event-fire">fire an event</span> named <code data-x="event-close">close</code>
Expand Down Expand Up @@ -82574,7 +82580,7 @@ picker.querySelector('.close-button').onclick = () => watcher.requestClose();</c
<code>CloseWatcher</code> from being destroying. A typical use case is as follows:</p>

<pre><code class="js">watcher.oncancel = async (e) => {
if (hasUnsavedData) {
if (hasUnsavedData && e.cancelable) {
e.preventDefault();

const userReallyWantsToClose = await askForConfirmation("Are you sure you want to close?");
Expand All @@ -82585,11 +82591,13 @@ picker.querySelector('.close-button').onclick = () => watcher.requestClose();</c
}
};</code></pre>

<p>For abuse prevention purposes, this event only fires if the page has <span>history-action
<p>For abuse prevention purposes, this event is only <code
data-x="dom-Event-cancelable">cancelable</code> if the page has <span>history-action
activation</span>, which will be lost after any given <span>close request</span>. This ensures
that if the user sends a close request twice in a row without any intervening user activation,
the request definitely succeeds; the second request ignores the <code
data-x="event-cancel">cancel</code> event handler and immediately closes the
the request definitely succeeds; the second request ignores any <code
data-x="event-cancel">cancel</code> event handler's attempt to call <code
data-x="dom-Event-preventDefault">preventDefault()</code> and proceeds to close the
<code>CloseWatcher</code>.</p>
</div>

Expand Down Expand Up @@ -98827,20 +98835,20 @@ location.href = '#foo';</code></pre>
<p>To <dfn export>navigate</dfn> a <span>navigable</span> <var>navigable</var> to a
<span>URL</span> <var>url</var> using a <code>Document</code> <var
id="source-browsing-context">sourceDocument</var>, with an optional <span>POST resource</span>,
string, or null <dfn data-x="navigation-resource"><var>documentResource</var></dfn> (default
null), an optional <span data-x="concept-response">response</span>-or-null <dfn
data-x="navigation-response"><var>response</var></dfn> (default null), an optional boolean <dfn
id="exceptions-enabled" export><var>exceptionsEnabled</var></dfn> (default false), an optional
<code>NavigationHistoryBehavior</code> <dfn
data-x="navigation-hh"><var>historyHandling</var></dfn> (default "<code
string, or null <dfn for="navigate" data-x="navigation-resource"
export><var>documentResource</var></dfn> (default null), an optional <span
data-x="concept-response">response</span>-or-null <dfn for="navigate"
data-x="navigation-response" export><var>response</var></dfn> (default null), an optional boolean
<dfn for="navigate" id="exceptions-enabled" export><var>exceptionsEnabled</var></dfn> (default
false), an optional <code>NavigationHistoryBehavior</code> <dfn for="navigate"
data-x="navigation-hh" export><var>historyHandling</var></dfn> (default "<code
data-x="NavigationHistoryBehavior-auto">auto</code>"), an optional <span>serialized
state</span>-or-null <dfn
data-x="navigation-navigation-api-state"><var>navigationAPIState</var></dfn> (default null), an
optional <span>entry list</span> or null <dfn
data-x="navigation-form-data-entry-list"><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
state</span>-or-null <dfn for="navigate" data-x="navigation-navigation-api-state"
export><var>navigationAPIState</var></dfn> (default null), an optional <span>entry list</span> or
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
data-x="navigation-user-involvement"><var>userInvolvement</var></dfn> (default "<code
data-x="uni-none">none</code>"):</p>

Expand Down Expand Up @@ -109593,7 +109601,7 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<var>referencingScript</var> is a <span>classic script</span> or a <span>JavaScript module
script</span>.</p></li>

<li><p>Set <var>fetchReferrer</var> to <var>referrer</var>'s <span
<li><p>Set <var>fetchReferrer</var> to <var>referencingScript</var>'s <span
data-x="concept-script-base-url">base URL</span>.</p></li>
</ol>

Expand Down Expand Up @@ -111044,18 +111052,18 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
data-x="struct item">items</span>:</p>

<ul>
<li><p>a <dfn data-x="event handler value">value</dfn>, which is either null<span
w-nodev>,</span><span w-dev> or</span> a callback object<span w-nodev>, or an <span>internal raw
uncompiled handler</span></span>. The <code>EventHandler</code> callback function type describes
how this is exposed to scripts. <span w-nodev>Initially, an <span data-x="event handlers">event
handler</span>'s <span data-x="event handler value">value</span> must be set to
null.</span></p></li>

<li><p>a <dfn export for="event handler" data-x="event handler listener">listener</dfn>, which is
either null or an <span>event listener</span><span w-nodev> responsible for running <span>the
event handler processing algorithm</span></span>. <span w-nodev>Initially, an <span data-x="event
handlers">event handler</span>'s <span data-x="event handler listener">listener</span> must be
set to null.</span></p></li>
<li><p>a <dfn export for="event handler" data-x="event handler value">value</dfn>, which is
either null<span w-nodev>,</span><span w-dev> or</span> a callback object<span w-nodev>, or an
<span>internal raw uncompiled handler</span></span>. The <code>EventHandler</code> callback
function type describes how this is exposed to scripts. <span w-nodev>Initially, an <span
data-x="event handlers">event handler</span>'s <span data-x="event handler value">value</span>
must be set to null.</span></p></li>

<li><p>a <dfn export for="event handler" data-x="event handler listener">listener</dfn>, which
is either null or an <span>event listener</span><span w-nodev> responsible for running <span>the
event handler processing algorithm</span></span>. <span w-nodev>Initially, an <span
data-x="event handlers">event handler</span>'s <span data-x="event handler
listener">listener</span> must be set to null.</span></p></li>
</ul>

</div>
Expand Down

0 comments on commit e516a82

Please sign in to comment.