Closed Bug 80627 Opened 24 years ago Closed 24 years ago

<form>.elements.namedItem() returns NodeList instead of a single node

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.4

People

(Reporter: c, Assigned: jst)

Details

(Keywords: dom1, Whiteboard: [HAVE FIX])

Attachments

(1 file)

<form>.elements.namedItem() returns a NodeList (HTMLCollection). It should return a single node. DOM1 says in http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-75708506 namedItem This method retrieves a Node using a name. It first searches for a Node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute. namedItem() works as expected when used with document.images, but with <form>.elements it behaves like document.getElementsByName().
Attached file testcase
Keywords: dom1
Additional note: This works, if only 1 element with the given name exists. Nominating for 1.0. We should not introduce a wrong DOM with our product.
Keywords: mozilla1.0
This patch fixes this problem. Index: content/html/content/src/nsHTMLFormElement.cpp =================================================================== RCS file: /cvsroot/mozilla/content/html/content/src/nsHTMLFormElement.cpp,v retrieving revision 1.72 diff -u -r1.72 nsHTMLFormElement.cpp --- nsHTMLFormElement.cpp 2001/05/08 16:44:47 1.72 +++ nsHTMLFormElement.cpp 2001/05/14 04:24:20 @@ -695,8 +695,8 @@ // XPConnect interface list for nsFormControlList NS_CLASSINFO_MAP_BEGIN(HTMLFormControlCollection) - NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFormControlList) NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLCollection) + NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFormControlList) NS_CLASSINFO_MAP_END
Status: NEW → ASSIGNED
OS: Windows NT → All
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.2
Tested the patch, it does fix the problem. Peter, want to r= ?
r=peterv.
Updating QA contact to Shivakiran Tummala.
QA Contact: desale → stummala
Moving to mozilla0.9.3
Target Milestone: mozilla0.9.2 → mozilla0.9.3
er come on let's get this in, this is getting silly (/me hates rotting patches)
No worries my friend, this will be fixed soon. :-)
Target Milestone: mozilla0.9.3 → mozilla0.9.4
This was fixed a while back, marking so...
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Yes, works with 2001-08-14-03, Win NT.
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: