Skip to content

Commit 789145a

Browse files
authored
Fix padding calculation in HTMLOptionsCollection's index setter
Correct an off-by-one error in the index setter of HTMLOptionsCollection when the target index is greater than the current length of the collection. Fixes #11905.
1 parent 0cb9486 commit 789145a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9805,15 +9805,15 @@ interface <dfn interface>HTMLOptionsCollection</dfn> : <span>HTMLCollection</spa
98059805
<li><p>Let <var>length</var> be the number of nodes <span>represented by the
98069806
collection</span>.</p></li>
98079807

9808-
<li><p>Let <var>n</var> be <var>index</var> minus <var>length</var>.</p></li>
9808+
<li><p>Let <var>delta</var> be <var>index</var> minus <var>length</var>.</p></li>
98099809

9810-
<li><p>If <var>n</var> is greater than zero, then <span
9811-
data-x="concept-node-append">append</span> a <code>DocumentFragment</code> consisting of <span
9812-
data-x=""><var>n</var>-1</span> new <code>option</code> elements with no attributes and
9810+
<li><p>If <var>delta</var> is greater than zero, then <span
9811+
data-x="concept-node-append">append</span> a <code>DocumentFragment</code> consisting of
9812+
<var>delta</var> new <code>option</code> elements with no attributes and
98139813
no child nodes to the <code>select</code> element on which the <code>HTMLOptionsCollection</code>
98149814
is rooted.</p></li>
98159815

9816-
<li><p>If <var>n</var> is greater than or equal to zero, <span
9816+
<li><p>If <var>delta</var> is greater than or equal to zero, <span
98179817
data-x="concept-node-append">append</span> <var>value</var> to the <code>select</code>
98189818
element. Otherwise, <span data-x="concept-node-replace">replace</span> the <var>index</var>th element in the collection by <var>value</var>.</p></li>
98199819
</ol>
@@ -156518,6 +156518,7 @@ INSERT INTERFACES HERE
156518156518
Lobotom Dysmon,
156519156519
Logan<!-- on moz irc -->,
156520156520
Logan Moore,
156521+
Lorenz Ackermann,
156521156522
Loune,
156522156523
Lucas Gadani,
156523156524
&#x0141;ukasz Pilorz,

0 commit comments

Comments
 (0)