Index: Source/core/html/HTMLSelectElement.cpp |
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp |
index b69ae389f79bb2fbc39e5b2884780e2496e927cf..0cdbab701da1c34fa27cbdfef7067775b74ae111 100644 |
--- a/Source/core/html/HTMLSelectElement.cpp |
+++ b/Source/core/html/HTMLSelectElement.cpp |
@@ -204,13 +204,19 @@ void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception |
// Make sure the element is ref'd and deref'd so we don't leak it. |
RefPtr<HTMLElement> protectNewChild(element); |
- if (!element || !(isHTMLOptionElement(element) || isHTMLHRElement(element))) |
+ if (!element || !(isHTMLOptionElement(element) || isHTMLOptGroupElement(element) || isHTMLHRElement(element))) |
return; |
insertBefore(element, before, exceptionState); |
setNeedsValidityCheck(); |
} |
+void HTMLSelectElement::addBeforeOptionAtIndex(HTMLElement* element, int beforeIndex, ExceptionState& exceptionState) |
+{ |
+ HTMLElement* beforeElement = toHTMLElement(options()->item(beforeIndex)); |
+ add(element, beforeElement, exceptionState); |
+} |
+ |
void HTMLSelectElement::remove(int optionIndex) |
{ |
int listIndex = optionToListIndex(optionIndex); |