This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10990 - HTMLFormElement.namedItem missing a case
Summary: HTMLFormElement.namedItem missing a case
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2010-10-07 21:51 UTC by Cameron McCormack
Modified: 2011-08-04 05:05 UTC (History)
5 users (show)

See Also:

Test whether HTMLFormElement name getter works (94 bytes, text/html)
2010-10-14 21:59 UTC, Cameron McCormack

Description Cameron McCormack 2010-10-07 21:51:53 UTC
Step 2 of the algorithm for HTMLFormElement.namedItem currently says:

  Otherwise, name is the name of one of the entries in the form element's past names map: return the object associated with name in that map.

However, it is possible to call namedItem with a name that is neither an element currently in the form nor the name of one of the entries in the past names map, since you can call namedItem directly:

  var f = document.createElement('form');

The algorithm should handle this case, or you should change the name getter declaration to:

  omittable caller getter any namedItem(in DOMString name);

so that there is no namedItem property on HTMLFormElements, if that's the intention.

(This may apply to other interfaces with name getters; I didn't check.)
Comment 1 Ian 'Hixie' Hickson 2010-10-14 08:25:02 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:

Status: Partially Accepted
Change Description: see diff given below
Rationale: I just removed the names altogether, there's no use case for having them. The compat need is just for the indexing and calling abilities, IIRC. (I was unfortunately unable to test IE to check this. Please reopen the bug if this is a compat regression, and I'll fix it the other way instead.)
Comment 2 contributor 2010-10-14 08:26:50 UTC
Checked in as WHATWG revision r5624.
Check-in comment: remove form.item() and form.namedItem() since 2/3 browsers I tested don't have it and removing them seems like a win.
Comment 3 Cameron McCormack 2010-10-14 21:59:22 UTC
Created attachment 923 [details]
Test whether HTMLFormElement name getter works

This test alerts an HTMLInputElement in IE9b.
Comment 4 Michael[tm] Smith 2011-08-04 05:05:44 UTC
mass-moved component to LC1