Skip to content

Commit 384c30c

Browse files
authored
Track HTML parser form-associated elements with a flag
Tests: web-platform-tests/wpt#6660. Fixes whatwg#2863 and fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=28800.
1 parent c230f55 commit 384c30c

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

source

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52163,6 +52163,8 @@ interface <dfn>HTMLLegendElement</dfn> : <span>HTMLElement</span> {
5216352163
element</span> is not associated with a <code>form</code> element, its <span>form owner</span> is
5216452164
said to be null.</p>
5216552165

52166+
<p>A <span>form-associated element</span> has an associated <dfn>parser inserted flag</dfn>.</p>
52167+
5216652168
<p>A <span>form-associated element</span> is, by default, associated with its <span
5216752169
w-nodev>nearest</span> ancestor <code>form</code> element<span w-nodev> (as described
5216852170
below)</span>, but, if it is <span data-x="category-listed">listed</span>, may have a <dfn><code
@@ -52192,14 +52194,25 @@ interface <dfn>HTMLLegendElement</dfn> : <span>HTMLElement</span> {
5219252194
data-x="concept-form-association">associated</dfn> with a form, its <span>form owner</span> must
5219352195
be set to that form.</p>
5219452196

52195-
<p>When a <span>form-associated element</span> or one of its ancestors <span>becomes
52196-
connected</span>, then the user agent must <span>reset the form owner</span> of that
52197-
<span>form-associated element</span>. <span class="note">The <span>HTML parser</span> overrides
52198-
this requirement when inserting form controls.</span></p>
52197+
<p>When a <span>form-associated element</span> or one of its ancestors <span data-x="nodes are
52198+
inserted">is inserted</span>, then:
52199+
52200+
<ol>
52201+
<li><p>If the <span>form-associated element</span>'s <span>parser inserted flag</span> is set,
52202+
then return.
52203+
52204+
<li><p><span>Reset the form owner</span> of the <span>form-associated element</span>.</p></li>
52205+
</ol>
5219952206

52200-
<p>When an element changes its parent node resulting in a <span>form-associated element</span> and
52201-
its <span>form owner</span> (if any) no longer being in the same <span>tree</span>, then the user
52202-
agent must <span>reset the form owner</span> of that <span>form-associated element</span>.</p>
52207+
<p>When a <span>form-associated element</span> or one of its ancestors <span data-x="nodes are
52208+
removed">is removed</span>, then:
52209+
52210+
<ol>
52211+
<li><p>If the <span>form-associated element</span> has a <span>form owner</span> and the
52212+
<span>form-associated element</span> and its <span>form owner</span> are no longer in the same
52213+
<span>tree</span>, then <span>reset the form owner</span> of the <span>form-associated
52214+
element</span>.</p></li>
52215+
</ol>
5220352216

5220452217
<p>When a <span data-x="category-listed">listed</span> <span>form-associated element</span>'s
5220552218
<code data-x="attr-fae-form">form</code> attribute is set, changed, or removed, then the user
@@ -52221,6 +52234,7 @@ interface <dfn>HTMLLegendElement</dfn> : <span>HTMLElement</span> {
5222152234
element</span> <var>element</var>, it must run the following steps:</p>
5222252235

5222352236
<ol>
52237+
<li><p>Unset <var>element</var>'s <span>parser inserted flag</span>.</p></li>
5222452238

5222552239
<li>
5222652240
<p>If all of the following conditions are true
@@ -104571,8 +104585,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
104571104585
<span>tree</span> as the element pointed to by the <span><code data-x="">form</code> element
104572104586
pointer</span>, then <span data-x="concept-form-association">associate</span> <var>element</var>
104573104587
with the <code>form</code> element pointed to by the <span><code data-x="">form</code> element
104574-
pointer</span> and suppress the running of the <span>reset the form owner</span> algorithm when
104575-
the parser subsequently attempts to insert the element.</p></li>
104588+
pointer</span> and set <var>element</var>'s <span>parser inserted flag</span>.</p></li>
104576104589

104577104590
<li><p>Return <var>element</var>.</p></li>
104578104591

@@ -120875,6 +120888,7 @@ INSERT INTERFACES HERE
120875120888
Morten Stenshorne,
120876120889
Mounir Lamouri,
120877120890
Ms2ger,
120891+
Mukilan Thiyagarajan,
120878120892
Nadia Heninger,
120879120893
NARUSE Yui,
120880120894
Navid Zolghadr,

0 commit comments

Comments
 (0)