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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>12299</bug_id>
          
          <creation_ts>2011-03-14 10:26:53 +0000</creation_ts>
          <short_desc>The (normative and non-normative) assertion that tokenlist.item(index) / tokenlist[index] returns null for index&gt;=length appears to be in conflict with WebIDL, at least for the index property case; afaict WebIDL requires that index property getters throw</short_desc>
          <delta_ts>2011-08-04 05:13:38 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#domtokenlist-0</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>ian</cc>
    
    <cc>james</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>46668</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-03-14 10:26:53 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html
Section: http://www.whatwg.org/specs/web-apps/current-work/#domtokenlist-0

Comment:
The (normative and non-normative) assertion that tokenlist.item(index) /
tokenlist[index] returns null for index&gt;=length appears to be in conflict with
WebIDL, at least for the index property case; afaict WebIDL requires that
index property getters throw Type Error for out or range values. It may be
possible per WebIDL to have .index and the index property getters do different
things, but that doesn&apos;t seem like super-useful behaviour. Possibly we should
throw in all cases.

Posted from: 88.131.66.80
User agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b13pre) Gecko/20110308 Firefox/4.0b13pre</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46669</commentid>
    <comment_count>1</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2011-03-14 10:32:21 +0000</bug_when>
    <thetext>Actually I think I might be wrong on what WebIDL requires; since corresponding properties for indexes outside the range are never created, trying to access such properties it will return undefined except in strict mode. Nevertheless the specs are inconsistent here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46671</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-03-14 12:28:50 +0000</bug_when>
    <thetext>[index] needs to return undefined when out of range.

.item(index) can do whatever it wants to.

That&apos;s how nodelists already behave: .item() returns null, while [index] returns undefined.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46672</commentid>
    <comment_count>3</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2011-03-14 12:49:17 +0000</bug_when>
    <thetext>NodeLists can change too...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46677</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-03-14 13:27:29 +0000</bug_when>
    <thetext>Can they?  No sites depending on the current behavior?

Throwing for out-of-bounds access on nodelist, btw, is _definitely_ not web-compatible.  Dunno about token list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46679</commentid>
    <comment_count>5</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2011-03-14 13:48:57 +0000</bug_when>
    <thetext>Right, I think the spec is *confusing* but I no longer think it is wrong except for the non-normative text which is very misleading about how out-of-bounds index access will work.

I don&apos;t think it is worth trying to change the null/undefined thing; given the subtlety of their distinction, any solution will feel wrong, so we may as well just go for what is already implemented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46686</commentid>
    <comment_count>6</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2011-03-14 18:49:40 +0000</bug_when>
    <thetext>Hmm, I was thinking of .item() returning undefined, but that might be hard to spec too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46687</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-03-14 18:54:03 +0000</bug_when>
    <thetext>Also impossible in some language bindings, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46697</commentid>
    <comment_count>8</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-03-14 21:18:09 +0000</bug_when>
    <thetext>Yep.  I think it is fine to leave item() return null where [n] would be undefined because the property doesn&apos;t exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48213</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-05-06 19:48:28 +0000</bug_when>
    <thetext>James, can you clarify what is confusing so that I can clear it up? I&apos;m not 100% sure how to improve this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48349</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-05-09 08:32:00 +0000</bug_when>
    <thetext>spoke to jgraham; this is about the domintro text specifically. we should make sure it doesn&apos;t imply that [index] access works like .item() access for out-of-range values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49591</commentid>
    <comment_count>11</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-06-14 21:56:22 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6223.
Check-in comment: Simplify the non-normative descriptions of index getters to avoid confusing readers (the specifics of edge cases are rather subtle).
http://html5.org/tools/web-apps-tracker?from=6222&amp;to=6223</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49592</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-06-14 22:03:14 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;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:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given above
Rationale: Concurred with reporter&apos;s comments on IRC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49676</commentid>
    <comment_count>13</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2011-06-16 09:17:55 +0000</bug_when>
    <thetext>Updated DOM Core accordingly.

http://dvcs.w3.org/hg/domcore/rev/9ef55e2543bd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53414</commentid>
    <comment_count>14</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:13:38 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>