<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>74546</bug_id>
          
          <creation_ts>2011-12-14 15:09:28 -0800</creation_ts>
          <short_desc>HTMLCollection.item should not return elements by ID/name</short_desc>
          <delta_ts>2011-12-14 16:00:57 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>74468</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>arv</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>521336</commentid>
    <comment_count>0</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2011-12-14 15:09:28 -0800</bug_when>
    <thetext>Currently, the implementation of item(unsigned long) looks at the ID/name of elements in the collection if the argument isn&apos;t an integer, for some value of integer. [1,2] WebIDL, [3] however, requires that the argument is converted into an integer by ToNumber, which returns NaN for normal strings, and then ToUint32, which is 0. So item(&quot;foo&quot;) should return the first element in the collection.

[1] &lt;http://www.google.com/codesearch#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp&amp;exact_package=chromium&amp;q=HTMLCollection&amp;l=74&gt;
[2] &lt;http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1280&gt;
[3] &lt;http://dev.w3.org/2006/webapi/WebIDL/#es-unsigned-long&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>521339</commentid>
    <comment_count>1</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-12-14 15:15:25 -0800</bug_when>
    <thetext>FWIW: IE9 does not do the ID lookup and item(&quot;foo&quot;) is treated as item(0)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>521348</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-14 15:20:37 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; FWIW: IE9 does not do the ID lookup and item(&quot;foo&quot;) is treated as item(0)

Right because item takes an index, not an id. The problem is that we&apos;re currently returning a list of nodes :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>521398</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-12-14 15:59:06 -0800</bug_when>
    <thetext>Dup of bug 74468?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>521399</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-14 16:00:57 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Dup of bug 74468?

So it seems.

*** This bug has been marked as a duplicate of bug 74468 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>