Index: Source/core/html/HTMLTableSectionElement.cpp |
diff --git a/Source/core/html/HTMLTableSectionElement.cpp b/Source/core/html/HTMLTableSectionElement.cpp |
index bf796d6ef31bfb3c654b4259965ecba9034fe4da..31a0f3ee7dbfcf68f3ae766b237d619fa5dd159b 100644 |
--- a/Source/core/html/HTMLTableSectionElement.cpp |
+++ b/Source/core/html/HTMLTableSectionElement.cpp |
@@ -27,6 +27,7 @@ |
#include "HTMLNames.h" |
#include "bindings/v8/ExceptionState.h" |
+#include "core/dom/ElementTraversal.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/html/HTMLCollection.h" |
#include "core/html/HTMLTableElement.h" |
@@ -95,15 +96,12 @@ void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat |
int HTMLTableSectionElement::numRows() const |
{ |
- int rows = 0; |
- const Node *n = firstChild(); |
- while (n) { |
- if (n->hasTagName(trTag)) |
- rows++; |
- n = n->nextSibling(); |
+ int rowCount = 0; |
+ for (const Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { |
+ if (child->hasTagName(trTag)) |
+ ++rowCount; |
} |
- |
- return rows; |
+ return rowCount; |
} |
PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() |