Skip to content

Commit

Permalink
Guard showModal() and showPopover() with fully active checks
Browse files Browse the repository at this point in the history
Closes #10659. This effectively only impacts dialogs and popovers "synthetic" documents, such as those created via document.implementation.createHTMLDocument().
  • Loading branch information
domenic committed Oct 16, 2024
1 parent 24f5496 commit cc36e13
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -61620,6 +61620,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>If <span>this</span> has an <code data-x="attr-dialog-open">open</code> attribute, then
throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <span>this</span>'s <span>node document</span> is not <span>fully active</span>, then
throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <span>this</span> is not <span>connected</span>, then throw an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

Expand Down Expand Up @@ -61649,9 +61652,8 @@ 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 <span>node document</span> is <span>fully active</span>, then 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
<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>
Expand All @@ -61665,10 +61667,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<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>

<p class="XXX">It would be better if this method failed early for the non-<span>fully
active</span> case. That is being tracked in <a
href="https://github.com/whatwg/html/issues/10659">issue #10659</a>.</p>
</li>

<li><p>Set <span>this</span>'s <span>previously focused element</span> to the
Expand Down Expand Up @@ -85397,10 +85395,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
</li>

<li id="canceling-popovers">
<p>If <var>document</var> is <span>fully active</span>, then set <var>element</var>'s
<span>popover 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>
<p>Set <var>element</var>'s <span>popover 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
Expand All @@ -85410,10 +85407,6 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
data-x="hide popover algorithm">hide a popover</span> given <var>element</var>, true, true,
and false.</p></li>
</ul>

<p class="XXX">It would be better if this algorithm failed early for the non-<span>fully
active</span> case. That is being tracked in <a
href="https://github.com/whatwg/html/issues/10659">issue #10659</a>.</p>
</li>
</ol>
</li>
Expand Down Expand Up @@ -85956,6 +85949,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<ul>
<li><p><var>element</var> is not <span>connected</span>;</p></li>

<li><p><var>element</var>'s <span>node document</span> is not <span>fully
active</span>;</p></li>

<li><p><var>expectedDocument</var> is not null and <var>element</var>'s <span>node
document</span> is not <var>expectedDocument</var>;</p></li>

Expand Down

0 comments on commit cc36e13

Please sign in to comment.