Skip to content

Commit b13b4d0

Browse files
committed
Ignore DOM state when hiding popovers if needed
Fixes whatwg#9161 Fixes whatwg#9367 Makes obsolete whatwg/dom#1185 This PR prevents the hide popover algorithm from returning early when the popover attribute is removed or when the element with the popover attribute is removed from the document. The fireEvents parameter is used as an indicator that either the element is being removed or that the attribute is being removed, and when it is false, the calls to check popover validity are replaced with a check to simply see if the popover is already hidden. This patch also makes removal of the popover attribute stop firing events in order to signal to the hide popover algorithm that checks for the popover attribute should be ignored.
1 parent 8430871 commit b13b4d0

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

source

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82409,9 +82409,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8240982409
<li><p>If <var>localName</var> is not <code data-x="attr-popover">popover</code>, then
8241082410
return.</p></li>
8241182411

82412+
<li><p>Let <var>fireEvents</var> be false if <var>value</var> is null, otherwise true.</p></li>
82413+
8241282414
<li><p>If <var>oldValue</var> and <var>value</var> are in different <span
8241382415
data-x="attr-popover">states</span>, then run the <span>hide popover algorithm</span> given
82414-
<var>element</var>, true, true, and false.</p></li>
82416+
<var>element</var>, true, <var>fireEvents</var>, and false.</p></li>
8241582417
</ol>
8241682418

8241782419
<dl class="domintro">
@@ -82613,8 +82615,17 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8261382615
boolean <var>fireEvents</var>, and a boolean <var>throwExceptions</var>:</p>
8261482616

8261582617
<ol>
82616-
<li><p>If the result of running <span>check popover validity</span> given <var>element</var>,
82617-
true, <var>throwExceptions</var>, and null is false, then return.</p></li>
82618+
<li>
82619+
<p>If <var>fireEvents</var> is true:</p>
82620+
82621+
<ol>
82622+
<li><p>If the result of running <span>check popover validity</span> given <var>element</var>,
82623+
true, <var>throwExceptions</var>, and null is false, then return.</p></li>
82624+
</ol>
82625+
</li>
82626+
82627+
<li><p>Otherwise, if <var>element</var>'s <span>popover visibility state</span> is <span
82628+
data-x="popover-hidden-state">hidden</span>, then return.</p></li>
8261882629

8261982630
<li><p>Let <var>document</var> be <var>element</var>'s <span>node document</span>.</p></li>
8262082631

@@ -82643,15 +82654,24 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8264382654
<var>element</var>, <var>focusPreviousElement</var>, and <var>fireEvents</var>.</p></li>
8264482655

8264582656
<li>
82646-
<p>If the result of running <span>check popover validity</span> given <var>element</var>,
82647-
true, and <var>throwExceptions</var> is false, then run <var>cleanupHidingFlag</var> and
82648-
return.</p>
82657+
<p>If <var>fireEvents</var> is true:</p>
8264982658

82650-
<p class="note"><span>Check popover validity</span> is called again because running <span
82651-
data-x="hide-all-popovers-until">hide all popovers until</span> could have disconnected
82652-
<var>element</var> or changed its <code data-x="attr-popover">popover</code> attribute.</p>
82659+
<ol>
82660+
<li>
82661+
<p>If the result of running <span>check popover validity</span> given <var>element</var>,
82662+
true, and <var>throwExceptions</var> is false, then run <var>cleanupHidingFlag</var> and
82663+
return.</p>
82664+
82665+
<p class="note"><span>Check popover validity</span> is called again because running <span
82666+
data-x="hide-all-popovers-until">hide all popovers until</span> could have disconnected
82667+
<var>element</var> or changed its <code data-x="attr-popover">popover</code> attribute.</p>
82668+
</li>
82669+
</ol>
8265382670
</li>
8265482671

82672+
<li><p>Otherwise, if <var>element</var>'s <span>popover visibility state</span> is <span
82673+
data-x="popover-hidden-state">hidden</span>, then return.</p></li>
82674+
8265582675
<li><p>If the last item in <var>document</var>'s <span>auto popover list</span> is
8265682676
<var>element</var>, then <span>break</span>.</p></li>
8265782677
</ol>

0 commit comments

Comments
 (0)