Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Unified Diff: Source/core/html/HTMLTableRowElement.cpp

Issue 262163008: HTMLTableSectionElement.insertRow(0) / HTMLTableRowElement.insertCell(0) do not behave correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLTableRowElement.cpp
diff --git a/Source/core/html/HTMLTableRowElement.cpp b/Source/core/html/HTMLTableRowElement.cpp
index 0e63ab98b32b7f910982630962dcb6ad32f9e0d5..93c6fecfae8b6e92997141346ea9e907aa90d545 100644
--- a/Source/core/html/HTMLTableRowElement.cpp
+++ b/Source/core/html/HTMLTableRowElement.cpp
@@ -135,16 +135,10 @@ PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionStat
}
RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, document());
- if (index < 0 || index >= numCells)
+ if (numCells == index || index == -1)
appendChild(cell, exceptionState);
- else {
- Node* n;
- if (index < 1)
- n = firstChild();
- else
- n = children->item(index);
- insertBefore(cell, n, exceptionState);
- }
+ else
+ insertBefore(cell, children->item(index), exceptionState);
return cell.release();
}

Powered by Google App Engine
This is Rietveld 408576698