Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: Source/core/html/HTMLSelectElement.cpp

Issue 213773003: select.add() should support optgroup adding and before index (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | Source/core/html/HTMLSelectElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | Source/core/html/HTMLSelectElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698