Skip to content

Commit

Permalink
Add request-close command for dialogs
Browse files Browse the repository at this point in the history
This new command maps to the dialog's requestClose function.
  • Loading branch information
lukewarlow committed Feb 19, 2025
1 parent 81fa58f commit 155ca45
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -53560,6 +53560,11 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
data-x="attr-button-command-close"><code>close</code></dfn>
<td><dfn data-x="attr-button-command-close-state">Close</dfn>
<td>Closes the targeted <code>dialog</code> element.
<tr>
<td><dfn attr-value for="html-global/command"
data-x="attr-button-command-request-close"><code>request-close</code></dfn>
<td><dfn data-x="attr-button-command-request-close-state">Request Close</dfn>
<td>Requests to close the targeted <code>dialog</code> element.
<tr>
<td><dfn attr-value for="html-global/command"
data-x="attr-button-command-show-modal"><code>show-modal</code></dfn>
Expand Down Expand Up @@ -62219,25 +62224,10 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
are:</p>

<ol>
<li><p>If <var>this</var> does not have an <code data-x="attr-dialog-open">open</code>
attribute, then return.</p></li>

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

<li><p>Set <var>dialog</var>'s <span>enable close watcher for <code
data-x="dom-dialog-requestClose">requestClose()</code></span> to true.</p></li>

<li><p>If <var>returnValue</var> is not given, then set it to null.</p></li>

<li><p>Set <var>this</var>'s <span>request close return value</span> to
<var>returnValue</var>.</p></li>

<li><p><span data-x="close-watcher-request-close">Request to close</span> <var>dialog</var>'s
<span data-x="dialog-close-watcher">close watcher</span> with false.</p></li>

<li><p>Set <var>dialog</var>'s <span>enable close watcher for <code
data-x="dom-dialog-requestClose">requestClose()</code></span> to false.</p></li>
<li><p><span data-x="dialog-request-close">Request to close the dialog</span> <span>this</span>
with <var>returnValue</var>.</p></li>
</ol>

<div class="note" id="note-dialog-method-names">
Expand Down Expand Up @@ -62474,9 +62464,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {

<ol>
<li><p>If <var>command</var> is in the <span
data-x="attr-button-command-close-state">Close</span> state or in the <span
data-x="attr-button-command-show-modal-state">Show Modal</span> state, then
return true.</p></li>
data-x="attr-button-command-close-state">Close</span> state, <span
data-x="attr-button-command-request-close-state">Request Close</span> state or the <span
data-x="attr-button-command-show-modal-state">Show Modal</span> state, then return true.</p></li>

<li><p>Return false.</p></li>
</ol>
Expand All @@ -62501,6 +62491,20 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
</ol>
</li>

<li>
<p>If <var>command</var> is in the <span
data-x="attr-button-command-request-close-state">Close</span> state and <var>element</var> has
an <code data-x="attr-dialog-open">open</code> attribute:</p>

<ol>
<li><p>Let <var>value</var> be <var>invoker</var>'s <span
data-x="concept-fe-value">value</span>.</p></li>

<li><p><span data-x="dialog-request-close">Request to close the dialog</span>
<var>element</var> with <var>value</var>.</p></li>
</ol>
</li>

<li><p>If <var>command</var> is the <span
data-x="attr-button-command-show-modal-state">Show Modal</span> state and <var>element</var> does
not have an <code data-x="attr-dialog-open">open</code> attribute, then
Expand Down Expand Up @@ -62603,6 +62607,29 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
</li>
</ol>

<p>To <dfn data-x="dialog-request-close">request to close</dfn> <code>dialog</code> element
<var>subject</var>, given null or a string <var>returnValue</var>:</p>

<ol>
<li><p>If <var>subject</var> does not have an <code data-x="attr-dialog-open">open</code>
attribute, then return.</p></li>

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

<li><p>Set <var>subject</var>'s <span>enable close watcher for <code
data-x="dom-dialog-requestClose">requestClose()</code></span> to true.</p></li>

<li><p>Set <var>subject</var>'s <span>request close return value</span> to
<var>returnValue</var>.</p></li>

<li><p><span data-x="close-watcher-request-close">Request to close</span> <var>subject</var>'s
<span data-x="dialog-close-watcher">close watcher</span> with false.</p></li>

<li><p>Set <var>subject</var>'s <span>enable close watcher for <code
data-x="dom-dialog-requestClose">requestClose()</code></span> to false.</p></li>
</ol>

</div>

<p>To <dfn>queue a dialog toggle event task</dfn> given a <code>dialog</code> element
Expand Down Expand Up @@ -143415,6 +143442,7 @@ interface <dfn interface>External</dfn> {
"<code data-x="attr-button-command-show-popover">show-popover</code>";
"<code data-x="attr-button-command-hide-popover">hide-popover</code>";
"<code data-x="attr-button-command-close">close</code>";
"<code data-x="attr-button-command-request-close">request-close</code>";
"<code data-x="attr-button-command-show-modal">show-modal</code>";
a <span data-x="attr-button-command-custom">custom command keyword</span>
<tr>
Expand Down

0 comments on commit 155ca45

Please sign in to comment.