Index: Source/core/html/HTMLOptionElement.cpp |
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp |
index c0b02f12ef71b46fdeb0ba02b6d1e17bed4813ba..abeb8577912a63d3971ce0dbd0ded390cc7e47b7 100644 |
--- a/Source/core/html/HTMLOptionElement.cpp |
+++ b/Source/core/html/HTMLOptionElement.cpp |
@@ -259,23 +259,12 @@ void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange |
HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const |
{ |
- for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) { |
- if (isHTMLDataListElement(*parent)) |
- return toHTMLDataListElement(parent); |
- } |
- return 0; |
+ return Traversal<HTMLDataListElement>::firstAncestor(*this); |
} |
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const |
{ |
- ContainerNode* select = parentNode(); |
- while (select && !isHTMLSelectElement(*select)) |
- select = select->parentNode(); |
- |
- if (!select) |
- return 0; |
- |
- return toHTMLSelectElement(select); |
+ return Traversal<HTMLSelectElement>::firstAncestor(*this); |
} |
String HTMLOptionElement::label() const |