Skip to content

Commit

Permalink
Make table.deleteRow(-1) a no-op when there are no rows
Browse files Browse the repository at this point in the history
This copies the wording of tbody.deleteRow, with "its parent" instead
of "this element". The previous wording would throw for this case.

Tests: web-platform-tests/wpt#4001
  • Loading branch information
foolip committed Oct 20, 2016
1 parent 8ffbd14 commit ad778cb
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -38253,19 +38253,16 @@ interface <dfn>HTMLTableElement</dfn> : <span>HTMLElement</span> {
steps:</p>

<ol>
<li><p>If <var>index</var> is less than &#x2212;1 or greater than or equal to the number of
elements in the <code data-x="dom-table-rows">rows</code> collection, then throw an
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <var>index</var> is equal to &#x2212;1, then <var>index</var> must be
set to the number of items in the <code data-x="dom-table-rows">rows</code> collection, minus
one.</p></li>

<li><p>Now, if <var>index</var> is less than zero, or greater than or equal to the
number of elements in the <code data-x="dom-table-rows">rows</code> collection, the method must
instead throw an <span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>, and these
steps must be aborted.</p></li>

<li><p>Otherwise, the method must remove the <var>index</var>th element in the <code
data-x="dom-table-rows">rows</code> collection from its parent.</p>
<li><p>If <var>index</var> is &#x2212;1, then <span data-x="concept-node-remove">remove</span>
the last element in the <code data-x="dom-table-rows">rows</code> collection from its parent, or
do nothing if the <code data-x="dom-table-rows">rows</code> collection is empty.</p></li>

<li><p>Otherwise, <span data-x="concept-node-remove">remove</span> the <var>index</var>th element
in the <code data-x="dom-table-rows">rows</code> collection from its parent.</p></li>
</ol>

</div>
Expand Down

0 comments on commit ad778cb

Please sign in to comment.