http://bugs.webkit.org/show_bug.cgi?id=7640
Menu items are displayed as "undefined"
WebCore:
* bindings/js/kjs_dom.cpp:
(KJS::DOMNodeProtoFunc::callAsFunction):
* bindings/js/kjs_domnode.h:
(KJS::DOMNode::):
Removed Node::item. No idea why it was there in the first place.
* bindings/js/kjs_html.cpp:
(KJS::HTMLElementFunction::callAsFunction):
* bindings/js/kjs_html.h:
(KJS::JSHTMLElement::):
Added HTMLSelectElement::item. It is not in DOM2 IDL, but the spec seems to mentions it anyway:
"The contained options can be directly accessed through the select element as a collection."
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::namedItem):
(WebCore::HTMLSelectElement::item):
* html/HTMLSelectElement.h:
* html/HTMLSelectElement.idl:
Added this method to DOM and IDL, too. Made namedItem() non-virtual.
LayoutTests:
* fast/dom/Window/window-properties-expected.txt: Updated the results.
* fast/dom/node-item-expected.txt: Added.
* fast/dom/node-item.html: Added.
Check that there is no Node:item or HTMLElement:item.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18674
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-01-08 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=7640
+ Menu items are displayed as "undefined"
+
+ * fast/dom/Window/window-properties-expected.txt: Updated the results.
+
+ * fast/dom/node-item-expected.txt: Added.
+ * fast/dom/node-item.html: Added.
+ Check that there is no Node:item or HTMLElement:item.
+
2007-01-08 Darin Adler <darin@apple.com>
- added a W3C list style test that was cited in a bug
window.DocumentFragment.prototype.isEqualNode [function]
window.DocumentFragment.prototype.isSameNode [function]
window.DocumentFragment.prototype.isSupported [function]
-window.DocumentFragment.prototype.item [function]
window.DocumentFragment.prototype.lookupNamespaceURI [function]
window.DocumentFragment.prototype.lookupPrefix [function]
window.DocumentFragment.prototype.normalize [function]
window.Element.prototype.isEqualNode [function]
window.Element.prototype.isSameNode [function]
window.Element.prototype.isSupported [function]
-window.Element.prototype.item [function]
window.Element.prototype.lookupNamespaceURI [function]
window.Element.prototype.lookupPrefix [function]
window.Element.prototype.normalize [function]
window.HTMLElement.prototype.isEqualNode [function]
window.HTMLElement.prototype.isSameNode [function]
window.HTMLElement.prototype.isSupported [function]
-window.HTMLElement.prototype.item [function]
window.HTMLElement.prototype.lookupNamespaceURI [function]
window.HTMLElement.prototype.lookupPrefix [function]
window.HTMLElement.prototype.normalize [function]
window.Node.prototype.isEqualNode [function]
window.Node.prototype.isSameNode [function]
window.Node.prototype.isSupported [function]
-window.Node.prototype.item [function]
window.Node.prototype.lookupNamespaceURI [function]
window.Node.prototype.lookupPrefix [function]
window.Node.prototype.normalize [function]
window.XMLDocument.prototype.isEqualNode [function]
window.XMLDocument.prototype.isSameNode [function]
window.XMLDocument.prototype.isSupported [function]
-window.XMLDocument.prototype.item [function]
window.XMLDocument.prototype.lookupNamespaceURI [function]
window.XMLDocument.prototype.lookupPrefix [function]
window.XMLDocument.prototype.normalize [function]
window.document.body.firstChild.isEqualNode [function]
window.document.body.firstChild.isSameNode [function]
window.document.body.firstChild.isSupported [function]
-window.document.body.firstChild.item [function]
window.document.body.firstChild.lang [string]
window.document.body.firstChild.lastChild [object Text]
window.document.body.firstChild.lastChild.ATTRIBUTE_NODE [number]
window.document.body.firstChild.lastChild.isEqualNode [function]
window.document.body.firstChild.lastChild.isSameNode [function]
window.document.body.firstChild.lastChild.isSupported [function]
-window.document.body.firstChild.lastChild.item [function]
window.document.body.firstChild.lastChild.lastChild [null]
window.document.body.firstChild.lastChild.length [number]
window.document.body.firstChild.lastChild.localName [string]
window.document.body.firstChild.nextSibling.isEqualNode [function]
window.document.body.firstChild.nextSibling.isSameNode [function]
window.document.body.firstChild.nextSibling.isSupported [function]
-window.document.body.firstChild.nextSibling.item [function]
window.document.body.firstChild.nextSibling.lastChild [null]
window.document.body.firstChild.nextSibling.length [number]
window.document.body.firstChild.nextSibling.localName [string]
window.document.body.firstChild.nextSibling.nextSibling.isEqualNode [function]
window.document.body.firstChild.nextSibling.nextSibling.isSameNode [function]
window.document.body.firstChild.nextSibling.nextSibling.isSupported [function]
-window.document.body.firstChild.nextSibling.nextSibling.item [function]
window.document.body.firstChild.nextSibling.nextSibling.lang [string]
window.document.body.firstChild.nextSibling.nextSibling.lastChild [null]
window.document.body.firstChild.nextSibling.nextSibling.localName [string]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.isEqualNode [function]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.isSameNode [function]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.isSupported [function]
-window.document.body.firstChild.nextSibling.nextSibling.nextSibling.item [function]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.lastChild [null]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.length [number]
window.document.body.firstChild.nextSibling.nextSibling.nextSibling.localName [string]
window.document.body.isEqualNode [function]
window.document.body.isSameNode [function]
window.document.body.isSupported [function]
-window.document.body.item [function]
window.document.body.lang [string]
window.document.body.lastChild [object HTMLScriptElement]
window.document.body.lastChild.ATTRIBUTE_NODE [number]
window.document.body.lastChild.isEqualNode [function]
window.document.body.lastChild.isSameNode [function]
window.document.body.lastChild.isSupported [function]
-window.document.body.lastChild.item [function]
window.document.body.lastChild.lang [string]
window.document.body.lastChild.lastChild [object Text]
window.document.body.lastChild.lastChild.ATTRIBUTE_NODE [number]
window.document.body.lastChild.lastChild.isEqualNode [function]
window.document.body.lastChild.lastChild.isSameNode [function]
window.document.body.lastChild.lastChild.isSupported [function]
-window.document.body.lastChild.lastChild.item [function]
window.document.body.lastChild.lastChild.lastChild [null]
window.document.body.lastChild.lastChild.length [number]
window.document.body.lastChild.lastChild.localName [string]
window.document.body.lastChild.previousSibling.isEqualNode [function]
window.document.body.lastChild.previousSibling.isSameNode [function]
window.document.body.lastChild.previousSibling.isSupported [function]
-window.document.body.lastChild.previousSibling.item [function]
window.document.body.lastChild.previousSibling.lastChild [null]
window.document.body.lastChild.previousSibling.length [number]
window.document.body.lastChild.previousSibling.localName [string]
window.document.body.parentNode.isEqualNode [function]
window.document.body.parentNode.isSameNode [function]
window.document.body.parentNode.isSupported [function]
-window.document.body.parentNode.item [function]
window.document.body.parentNode.lang [string]
window.document.body.parentNode.lastChild [printed above as window.document.body]
window.document.body.parentNode.localName [string]
window.document.isEqualNode [function]
window.document.isSameNode [function]
window.document.isSupported [function]
-window.document.item [function]
window.document.lastChild [printed above as window.document.body.parentNode]
window.document.lastModified [string]
window.document.linkColor [string]
--- /dev/null
+Test for bug 7640: Menu items are displayed as "undefined".
+
+Node.item() should not exist.
+
+SUCCESS
+
--- /dev/null
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=7640">bug 7640</a>:
+Menu items are displayed as "undefined".</p>
+<p>Node.item() should not exist.</p>
+<div id=result> </div>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ divElement = document.getElementById("result");
+ textNode = divElement.firstChild;
+
+ if (textNode.item != undefined)
+ document.getElementById("result").firstChild.data="FAILURE: Node.item = " + textNode.item;
+ else if (divElement.item != undefined)
+ document.getElementById("result").firstChild.data="FAILURE: HTMLDivElement.item = " + divElement.item;
+ else
+ document.getElementById("result").firstChild.data="SUCCESS";
+</script>
+</body>
+2007-01-08 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Darin.
+
+ http://bugs.webkit.org/show_bug.cgi?id=7640
+ Menu items are displayed as "undefined"
+
+ * bindings/js/kjs_dom.cpp:
+ (KJS::DOMNodeProtoFunc::callAsFunction):
+ * bindings/js/kjs_domnode.h:
+ (KJS::DOMNode::):
+ Removed Node::item. No idea why it was there in the first place.
+
+ * bindings/js/kjs_html.cpp:
+ (KJS::HTMLElementFunction::callAsFunction):
+ * bindings/js/kjs_html.h:
+ (KJS::JSHTMLElement::):
+ Added HTMLSelectElement::item. It is not in DOM2 IDL, but the spec seems to mentions it anyway:
+ "The contained options can be directly accessed through the select element as a collection."
+
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::namedItem):
+ (WebCore::HTMLSelectElement::item):
+ * html/HTMLSelectElement.h:
+ * html/HTMLSelectElement.idl:
+ Added this method to DOM and IDL, too. Made namedItem() non-virtual.
+
2007-01-08 Beth Dakin <bdakin@apple.com>
Reviewed by Maciej.
isDefaultNamespace DOMNode::IsDefaultNamespace DontDelete|Function 1
lookupNamespaceURI DOMNode::LookupNamespaceURI DontDelete|Function 1
lookupPrefix DOMNode::LookupPrefix DontDelete|Function 1
-# "DOM level 0" (from Gecko DOM reference; also in WinIE)
- item DOMNode::Item DontDelete|Function 1
@end
*/
KJS_IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
if (node.replaceChild(toNode(args[0]), toNode(args[1]), exception))
return args[1];
return jsNull();
- case DOMNode::Item:
- return thisObj->get(exec, args[0]->toInt32(exec));
}
return jsUndefined();
virtual UString toString(ExecState*) const;
enum { NodeName, NodeValue, NodeType, ParentNode, ParentElement,
- ChildNodes, FirstChild, LastChild, PreviousSibling, NextSibling, Item,
+ ChildNodes, FirstChild, LastChild, PreviousSibling, NextSibling,
Attributes, NamespaceURI, Prefix, LocalName, OwnerDocument, InsertBefore,
ReplaceChild, RemoveChild, AppendChild, HasAttributes, HasChildNodes,
CloneNode, Normalize, IsSupported, Contains, IsSameNode, IsEqualNode, TextContent,
length KJS::JSHTMLElement::SelectLength DontDelete
form KJS::JSHTMLElement::SelectForm DontDelete|ReadOnly
options KJS::JSHTMLElement::SelectOptions DontDelete|ReadOnly
+ item KJS::JSHTMLElement::SelectItem DontDelete|Function 1
namedItem KJS::JSHTMLElement::SelectNamedItem DontDelete|Function 1
disabled KJS::JSHTMLElement::SelectDisabled DontDelete
multiple KJS::JSHTMLElement::SelectMultiple DontDelete
select.focus();
return jsUndefined();
}
+ else if (id == JSHTMLElement::SelectItem) {
+ return toJS(exec, select.item(args[0]->toUInt32(exec)));
+ }
else if (id == JSHTMLElement::SelectNamedItem) {
return toJS(exec, select.namedItem(Identifier(args[0]->toString(exec))));
}
enum {
SelectAdd,
SelectTabIndex, SelectValue, SelectSelectedIndex, SelectLength,
- SelectRemove, SelectForm, SelectBlur, SelectType, SelectOptions,
+ SelectRemove, SelectForm, SelectBlur, SelectType, SelectOptions, SelectItem,
SelectDisabled, SelectMultiple, SelectName, SelectNamedItem, SelectSize, SelectFocus,
ObjectHspace, ObjectHeight, ObjectAlign,
ObjectBorder, ObjectCode, ObjectType, ObjectVspace, ObjectArchive,
Node* HTMLSelectElement::namedItem(const String &name, bool caseSensitive)
{
- return (options()->namedItem(name, caseSensitive));
+ return options()->namedItem(name, caseSensitive);
+}
+
+Node* HTMLSelectElement::item(unsigned index)
+{
+ return options()->item(index);
}
void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement* option, ExceptionCode& ec)
void setOption(unsigned index, HTMLOptionElement*, ExceptionCode&);
void setLength(unsigned, ExceptionCode&);
- virtual Node* namedItem(const String& name, bool caseSensitive = true);
+ Node* namedItem(const String& name, bool caseSensitive = true);
+ Node* item(unsigned index);
HTMLCollection::CollectionInfo* collectionInfo() { return &m_collectionInfo; }
void blur();
void focus();
+ // This method is not in DOM Level 2 IDL, but it is mentioned in the standard:
+ // "The contained options can be directly accessed through the select element as a collection."
+ Node item(in [IsIndex] unsigned long index);
};
}