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(); |
} |