Reviewed by Adele.
authoraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2006 00:15:13 +0000 (00:15 +0000)
committeraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2006 00:15:13 +0000 (00:15 +0000)
        * bindings/js/kjs_html.cpp:
        added bindings
        (KJS::HTMLElementFunction::callAsFunction):
        added case to handle namedItem for select elements
        * bindings/js/kjs_html.h:
        added enum value for bindings
        (KJS::JSHTMLElement::):
        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::namedItem):
        implemented namedItem method
        * html/HTMLSelectElement.h:
        added prototype for namedItem method

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14602 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_html.h
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLSelectElement.h

index 3194c8db37f97ec17a7f36e5ef43b8ee82cce778..5172517b3234446bd5133dd95a0e5e30a0d8d268 100644 (file)
@@ -1,3 +1,20 @@
+2006-05-25  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Adele.
+
+        * bindings/js/kjs_html.cpp:
+        added bindings
+        (KJS::HTMLElementFunction::callAsFunction):
+        added case to handle namedItem for select elements
+        * bindings/js/kjs_html.h:
+        added enum value for bindings
+        (KJS::JSHTMLElement::):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::namedItem):
+        implemented namedItem method
+        * html/HTMLSelectElement.h:
+        added prototype for namedItem method
+
 2006-05-25  Dave Hyatt <hyatt@apple.com>
 
         Make soft hyphens work on Win32 by special casing them
index 482f49035a40d20bf1104761b590cde69fae632f..5c7e7a200945f1799bfca3d7e7399ba9f1e7ea96 100644 (file)
@@ -555,6 +555,7 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
   length        KJS::JSHTMLElement::SelectLength  DontDelete
   form          KJS::JSHTMLElement::SelectForm    DontDelete|ReadOnly
   options       KJS::JSHTMLElement::SelectOptions DontDelete|ReadOnly
+  namedItem     KJS::JSHTMLElement::SelectNamedItem       DontDelete|Function 1
   disabled      KJS::JSHTMLElement::SelectDisabled        DontDelete
   multiple      KJS::JSHTMLElement::SelectMultiple        DontDelete
   name          KJS::JSHTMLElement::SelectName    DontDelete
@@ -1202,6 +1203,9 @@ JSValue *HTMLElementFunction::callAsFunction(ExecState* exec, JSObject* thisObj,
             select.focus();
             return jsUndefined();
         }
+        else if (id == JSHTMLElement::SelectNamedItem) {
+            return toJS(exec, select.namedItem(Identifier(args[0]->toString(exec))));
+        }
     }
     else if (element.hasLocalName(tableTag)) {
         HTMLTableElement &table = static_cast<HTMLTableElement &>(element);
index 3cba35dc9d4dfc5d3c2ba8d79d8800750c3e0001..bf3aa203c662ca17ffdb6e04540b0e50141b87fc 100644 (file)
@@ -124,7 +124,7 @@ namespace KJS {
            SelectAdd,
            SelectTabIndex, SelectValue, SelectSelectedIndex, SelectLength,
            SelectRemove, SelectForm, SelectBlur, SelectType, SelectOptions,
-           SelectDisabled, SelectMultiple, SelectName, SelectSize, SelectFocus,
+           SelectDisabled, SelectMultiple, SelectName, SelectNamedItem, SelectSize, SelectFocus,
            ObjectHspace, ObjectHeight, ObjectAlign,
            ObjectBorder, ObjectCode, ObjectType, ObjectVspace, ObjectArchive,
            ObjectDeclare, ObjectForm, ObjectCodeBase, ObjectCodeType, ObjectData,
index a8d7dd7fd9cc4a617b39011baebdeec7227bd343..07c8fdb671b05b840ac999771da56c67175bd1d7 100644 (file)
@@ -456,5 +456,10 @@ void HTMLSelectElement::setSize(int size)
 {
     setAttribute(sizeAttr, String::number(size));
 }
-    
+
+Node* HTMLSelectElement::namedItem(const String &name, bool caseSensitive)
+{
+    return (options()->namedItem(name, caseSensitive));
+}
+
 } // namespace
index 571aa204650784168074efe4988a8a3fc7627f97..f45d519200de113a3f7580da754d89a2426a5c1a 100644 (file)
@@ -108,6 +108,8 @@ public:
 
     void setSize(int);
 
+    virtual Node* namedItem(const String &name, bool caseSensitive = true);
+
 private:
     void recalcListItems();