Index: Source/core/html/HTMLOptionElement.cpp |
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp |
index 1bdde70b90d434be260de3938d7652317c9ab16a..7cfb50ceaae9e12b39c81db57ae047759d818adf 100644 |
--- a/Source/core/html/HTMLOptionElement.cpp |
+++ b/Source/core/html/HTMLOptionElement.cpp |
@@ -132,10 +132,8 @@ void HTMLOptionElement::setText(const String &text, ExceptionState& exceptionSta |
bool selectIsMenuList = select && select->usesMenuList(); |
int oldSelectedIndex = selectIsMenuList ? select->selectedIndex() : -1; |
- // Handle the common special case where there's exactly 1 child node, and it's a text node. |
- Node* child = firstChild(); |
- if (child && child->isTextNode() && !child->nextSibling()) |
- toText(child)->setData(text); |
+ if (hasOneTextChild()) |
haraken
2014/11/04 18:02:30
Nit: Add { } because the else clause has { }
|
+ toText(firstChild())->setData(text); |
else { |
removeChildren(); |
appendChild(Text::create(document(), text), exceptionState); |