[webkit-dev] HTMLSelectElement and namedItem()

David Moore davemoore at google.com
Fri Apr 10 07:47:20 PDT 2009


According to the HTML5 spec we should be returning a node collection if
there are multiple matches, both for HTMLSelectElement and
HTMLOptionsCollection. So neither Safari or chromium is in conformance to
this. Safari always returns null for named elements in HTMLSelectElement no
matter how many matches and chromium returns at most 1 element for both
HTMLSelectElement and HTMLOptionsCollection.
The relevant parts of the spec are:
http://dev.w3.org/html5/spec/Overview.html#the-select-element
and
http://dev.w3.org/html5/spec/Overview.html#htmloptionscollection-0

Dave

On Thu, Apr 9, 2009 at 2:22 PM, Ian Hickson <ian at hixie.ch> wrote:

> On Thu, 9 Apr 2009, David Moore wrote:
> >
> > I've looked at FF, IE and Opera. FF doesn't support named item access
> > from an HTMLSelectElement. It does support it from
> > HTMLOptionsCollection, and returns 1 element even if there are multiple
> > options with the same name.
> >
> > IE doesn't support named item access from either HTMLSelectElement or
> > HTMLOptionsCollection.
> >
> > Opera supports named item access from both HTMLSelectElements and
> > HTMLOptionsCollections. In both cases it returns a single element if
> > there are duplicate names.
>
> Note that HTML5 defines the expected behaviour here in some detail.
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090410/240baade/attachment.html>


More information about the webkit-dev mailing list