Skip to content

Commit

Permalink
Add enabled boolean to close watchers and add some changes that might…
Browse files Browse the repository at this point in the history
… handle closedby dynamically
  • Loading branch information
lukewarlow committed May 8, 2024
1 parent 4a0554d commit 96a4138
Showing 1 changed file with 57 additions and 82 deletions.
139 changes: 57 additions & 82 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -61378,26 +61378,24 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
value is the empty string.</p></li>

<li>
<p>If <span>this</span>'s <code data-x="attr-dialog-closedby">closedby</code> attribute state
is <span data-x="attr-closedby-any-state">any</span> or <span
data-x="attr-closedby-closerequest-state">closerequest</span> then:</p>
<p>Set <span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the
result of <span data-x="establish a close watcher">establishing a close watcher</span> given
<span>this</span>'s <span>relevant global object</span>, with:</p>

<ol>
<li><p>Set <span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the
result of <span data-x="establish a close watcher">establishing a close watcher</span> given
<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
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>

<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
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>
<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>

<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>
</ul>
</li>
</ol>
<li><p><i data-x="create-close-watcher-enabled">enabled</i> being true if <span>this</span>'s
<code data-x="attr-dialog-closedby">closedby</code> attribute state is <span
data-x="attr-closedby-any-state">Any</span> or <span
data-x="attr-closedby-closerequest-state">Close Request</span>; otherwise false.</p></li>
</ul>
</li>

<li><p>Set <span>this</span>'s <span>previously focused element</span> to the
Expand Down Expand Up @@ -61454,25 +61452,25 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
to the top layer</span> given <span>this</span>.</p></li>

<li id="canceling-dialogs">
<p>If <span>this</span>'s <code data-x="attr-dialog-closedby">closedby</code> attribute state
is not <span data-x="attr-closedby-none-state">none</span> then:</p>
<p>Set <span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the
result of <span data-x="establish a close watcher">establishing a close watcher</span> given
<span>this</span>'s <span>relevant global object</span>, with:</p>

<ol>
<li><p>Set <span>this</span>'s <span data-x="dialog-close-watcher">close watcher</span> to the
result of <span data-x="establish a close watcher">establishing a close watcher</span> given
<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
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>

<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
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>
<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>

<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>
</ul>
</li>
</ol>
<li><p><i data-x="create-close-watcher-enabled">enabled</i> being true if <span>this</span>'s
<code data-x="attr-dialog-closedby">closedby</code> attribute is in the <span
data-x="attr-closedby-any-state">Any</span>, <span
data-x="attr-closedby-closerequest-state">Close Request</span>, or <span
data-x="attr-closedby-auto-state">Auto</span> state; otherwise false.</p></li>
</ul>
</li>

<li><p>Set <span>this</span>'s <span>previously focused element</span> to the
Expand Down Expand Up @@ -61696,53 +61694,16 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>If <var>oldValue</var> and <var>value</var> are in the same <span
data-x="attr-dialog-closedby">state</span>, then return.</p></li>

<li><p>If <var>value</var> is in the <span data-x="attr-closedby-none-state">none state</span>
or <span data-x="attr-closedby-auto-state">auto state</span> and <var>element</var>'s <span>is
modal</span> flag is false then:</p>
<ol>
<li>
<p>If <var>element</var>'s <span data-x="dialog-close-watcher">close watcher</span> is not
null, then:</p>

<ol>
<li><p><span data-x="close-watcher-destroy">Destroy</span> <var>element</var>'s <span
data-x="dialog-close-watcher">close watcher</span>.</p></li>
<li><p><span>Assert</span>: <var>element</var>'s <span data-x="dialog-close-watcher">close
watcher</span> is not null.</p></li>

<li><p>Set <var>element</var>'s <span data-x="dialog-close-watcher">close watcher</span> to
null.</p></li>
</ol>
</li>
</ol>
</li>
<li><p>If <var>value</var> is in the <span
data-x="attr-closedby-closerequest-state">closerequest state</span>, <span
data-x="attr-closedby-any-state">any state</span>, or <span
data-x="attr-closedby-auto-state">auto state</span> and <var>element</var>'s <span>is
modal</span> flag is true then:</p>
<ol>
<li>
<p>If <var>element</var>'s <span data-x="dialog-close-watcher">close watcher</span> is null,
then:</p>

<ol>
<li><p>Set <var>element</var>'s <span data-x="dialog-close-watcher">close watcher</span> to
the result of <span data-x="establish a close watcher">establishing a close watcher</span>
given <var>element</var>'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
data-x="event-cancel">cancel</code> at <var>element</var>, with the <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>
<li><p>If <var>value</var> is in the <span data-x="attr-closedby-any-state">Any</span> state,
or <span data-x="attr-closedby-closerequest-state">Close Request</span> state,
or <span data-x="attr-closedby-auto-state">Auto</span> state and <var>element</var>'s <span>is
modal</span> flag is true, then let <var>enabled</var> to true; otherwise false.</p></li>

<li><p><i data-x="create-close-watcher-closeAction">closeAction</i> being to <span>close
the dialog</span> given <var>element</var> and null.</p></li>
</ul>
</li>
</ol>
</li>
</ol>
</li>
<li><p>Set <var>element</var>'s <span data-x="dialog-close-watcher">close watcher</span>'s <span
data-x="close-watcher-enabled">enabled</span> boolean to <var>enabled</var>.</p></li>
</ol>

<hr>
Expand Down Expand Up @@ -61832,7 +61793,7 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>Let <var>clickedDialog</var> be the result of running <span>nearest inclusive open
dialog</span> given <var>node</var>.</p></li>

<li><p>Return <var>clickedDialog</var></li>
<li><p>Return <var>clickedDialog</var>.</p></li>
</ol>

<p>To get the <dfn id="any-dialog-list">showing any dialog list</dfn> for a
Expand Down Expand Up @@ -82352,6 +82313,8 @@ body { display:none }

<li><p>An <dfn data-x="close-watcher-is-running-cancel">is running cancel action</dfn>
boolean.</p></li>

<li><p>An <dfn data-x="close-watcher-enabled">enabled</dfn> boolean.</p></li>
</ul>

<p>A <span>close watcher</span> <var>closeWatcher</var> <dfn data-x="close-watcher-active">is
Expand All @@ -82362,8 +82325,10 @@ body { display:none }
<hr>

<p>To <dfn>establish a close watcher</dfn> given a <code>Window</code> <var>window</var>, a list
of steps <dfn data-x="create-close-watcher-cancelAction"><var>cancelAction</var></dfn>, and a
list of steps <dfn data-x="create-close-watcher-closeAction"><var>closeAction</var></dfn>:</p>
of steps <dfn data-x="create-close-watcher-cancelAction"><var>cancelAction</var></dfn>, a
list of steps <dfn data-x="create-close-watcher-closeAction"><var>closeAction</var></dfn>,
and an optional boolean <dfn data-x="create-close-watcher-enabled"><var>enabled</var></dfn>
(default true):</p>

<ol>
<li><p><span>Assert</span>: <var>window</var>'s <span
Expand All @@ -82385,6 +82350,9 @@ body { display:none }

<dt><span data-x="close-watcher-is-running-cancel">is running cancel action</span></dt>
<dd>false</dd>

<dt><span data-x="close-watcher-enabled">enabled</span></dt>
<dd><var>enabled</var></dd>
</dl>
</li>

Expand Down Expand Up @@ -82424,6 +82392,9 @@ body { display:none }
<li><p>If <var>closeWatcher</var> <span data-x="close-watcher-active">is not active</span>, then
return true.</p></li>

<li><p>If <var>closeWatcher</var>'s <span data-x="close-watcher-enabled">enabled</span> is false,
then return true.</p></li>

<li><p>If <var>closeWatcher</var>'s <span data-x="close-watcher-is-running-cancel">is running
cancel action</span> is true, then return true.</p></li>

Expand Down Expand Up @@ -82479,6 +82450,9 @@ body { display:none }
<li><p>If <var>closeWatcher</var> <span data-x="close-watcher-active">is not active</span>, then
return.</p></li>

<li><p>If <var>closeWatcher</var>'s <span data-x="close-watcher-enabled">enabled</span> is false,
then return true.</p></li>

<li><p>If <var>closeWatcher</var>'s <span data-x="close-watcher-window">window</span>'s <span
data-x="concept-document-window">associated <code>Document</code></span> is not <span>fully
active</span>, then return.</p></li>
Expand Down Expand Up @@ -82526,7 +82500,8 @@ body { display:none }
in reverse order:</p>

<ol>
<li><p>Set <var>processedACloseWatcher</var> to true.</p></li>
<li><p>If <var>closeWatcher</var>'s <span data-x="close-watcher-enabled">enabled</span> is
true, set <var>processedACloseWatcher</var> to true.</p></li>

<li><p>Let <var>shouldProceed</var> be the result of <span
data-x="close-watcher-request-close">requesting to close</span>
Expand Down

0 comments on commit 96a4138

Please sign in to comment.