<?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>23212</bug_id>
          
          <creation_ts>2013-09-11 10:34:12 +0000</creation_ts>
          <short_desc>Add iterator support to NodeList, HTMLCollection, DOMTokenList, and DOMSettableTokenList</short_desc>
          <delta_ts>2014-10-06 12:36:00 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>17648</dependson>
    
    <dependson>26183</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne">annevk</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93237</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-09-11 10:34:12 +0000</bug_when>
    <thetext>Maybe also NodeIterator and AttrMap if we end up having to add that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112684</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-04 06:56:33 +0000</bug_when>
    <thetext>I also removed [ArrayClass] support per https://code.google.com/p/chromium/issues/detail?id=229398#c11 No longer worth persuing.

I was unclear on NodeIterator. If anyone would like to have something there, let me know in a new bug. Thanks.

https://github.com/whatwg/dom/commit/72a2f99e968571989790d58f5b35e8465c52a462</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112705</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-05 03:00:47 +0000</bug_when>
    <thetext>Why did you add legacyiterable to HTMLCollection?  Especially without defining the actual resulting behavior?  It&apos;s iterable anyway, because it has an indexed getter, and the resulting behavior seems just fine to me.

Similar for NamedNodeMap, though there you spelled it wrong too.

Adding iterable&lt;&gt; to DOMTokenList at least makes some sense if the goal is to get the extra methods...  But the fact that it forces the use of a different iterator is pretty annoying.  Cameron, could we have a way of getting the extra methods on something with an indexed getter without having to redefine the array iterator behavior?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112718</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-05 07:28:01 +0000</bug_when>
    <thetext>As far as I can tell from IDL, if an interface has &quot;supported property indices&quot; you do not need to spell out the iterable behavior, but you do need the iterable&lt;&gt; declaration. Is that not true? It might be better if that were not true.

(Having said that, that means I can remove the description from NodeList and DOMTokenList as well. I thought named getters were required for some reason.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112724</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-06 04:54:23 +0000</bug_when>
    <thetext>You have it backwards.

Per http://heycam.github.io/webidl/#es-iterators you get an @@iterator if you have indexed props and a length, or an iterable declaration, maplike declaration, or setlike declaration.

If you have an iterable declaration you then have to specify how it behaves.  And the important part for purposes of this bug is this paragraph:

  If the interface does not have an iterable declaration but does define an
  indexed property getter, then the Function object is %ArrayProto_values%
  ([ECMA-262], section 6.1.7.4). 

I see that http://heycam.github.io/webidl/#idl-iterable has this language:

  Prose accompanying an interface with a value iterator MUST define what the
  list of values to iterate over is, unless the interface also supports indexed
  properties, in which case the values of the indexed properties are implicitly
  iterated over.

which certainly makes it sound like in the indexed prop case iteration happens over those even in the face of an iterable declaration.  This is flat-out contradicting the normative language in the es-iterators section, and I can only assume that this is a bug I didn&apos;t catch in reading over the text in bug 26183 because I only read the ES-relevant bits...  I&apos;ll comment there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112727</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-06 07:46:36 +0000</bug_when>
    <thetext>Yeah, that language confused me.

So I should remove the legacyiterable&lt;&gt; declaration from HTMLCollection and NamdeNodeMap and remove the description from NodeList and DOMTokenList. Correct?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112736</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-06 11:54:33 +0000</bug_when>
    <thetext>The way things stand right now, if you have an iterable&lt;&gt; declaration you need a description of the iterator behavior.  That is, explicitly saying you&apos;re iterable totally overrides the default behavior for indexed props.

Obviously we can change Web IDL to not do that, but we should think about whether there are cases when someone _would_ want a non-default iterator behavior for something with indexed props....

You should definitely remove the legacyiterable bits, though.  I see no use cases for that one, really.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112740</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-06 12:17:27 +0000</bug_when>
    <thetext>I filed bug 26984 on removing legacyiterable from IDL.

I filed bug 26985 on removing the requirement around prose for objects that have both indexed property getters and iterable&lt;&gt;.

I filed bug 26986 on deprecating indexed property getters.


For now in DOM I&apos;ll remove legacyiterable and leave the prose.

Is there anything I&apos;m still missing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112741</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-06 12:20:56 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/f191218113035dbb023c697b6fc4cbc22c953284</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112744</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-06 12:31:09 +0000</bug_when>
    <thetext>Looks like I was moderately confused too.  See bug 26985 comment 2.

I think we still need Web IDL changes to improve the behavior to not make the use of iterable&lt;&gt; stop us using the array iterator, but the current spec does not in fact need prose for iterable&lt;&gt; on something with indexed props.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112745</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-06 12:36:00 +0000</bug_when>
    <thetext>Thanks Boris. That was very helpful.

https://github.com/whatwg/dom/commit/5e432dc0d618b717d711994f276bf523eb27f674</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>