Why not NodeList#forEach :\?

David Bruant bruant.d at gmail.com
Tue Jun 19 05:29:15 PDT 2012

Le 19/06/2012 14:11, Alex Russell a écrit :
> On Jun 11, 2012, at 11:46 AM, David Bruant wrote:
>> Hi,
>> Le 11/06/2012 12:30, Hemanth H.M a écrit :
>>> [].forEach.call(NodeList,function(elm) {}) why that? Why not treat it like an [] ?
>> I've written a section on MDN specifically a while ago to answer that very question: https://developer.mozilla.org/En/DOM/NodeList#Why_can%27t_I_use_forEach_or_map_on_a_NodeList.3F
>> Regardless, that's not in ECMAScript's scope. ECMAScript is about the language (syntax, semantics, etc.), while NodeList are part of the DOM which can be considered as an ECMAScript library. However, of course, browsers all ship this "library" by default. It is however not present in server-side environments like Node.js.
>> A longer time ago, I wrote another page to describe what "JavaScript" mean, because it has become an umbrella term to talk about a lot of different technologies: https://developer.mozilla.org/en/JavaScript_technologies_overview
> Be that as it may, the intent of the new elem.find() API
Where is this API defined (or being discussed)? I don't recall anything 
about that in ECMAScript proposals/strawmen and I can't find it in the 
latest DOM4 draft.

> is to give us a chance to fix this (among other) errors in DOM's design. Yes, it's up to DOM to fix it, but we need ES to adopt things like Allen's Object Model Reformation to help enable it:
> http://wiki.ecmascript.org/doku.php?id=strawman:object_model_reformation
I guess knowing what the elem.find() API is will help me understand this 
part better, because I'm not sure I see the link between the object 
model reformulation and fixing the DOM API. Can you elaborate further on 
that? (if this discussion already happened somewhere else, a link to 
that discussion will be enough,  of course)

Meanwhile, when you say "us" or "we", who are you referring to? The 
"es-discuss" folks, TC39, the DOM APIs folks, web devs interested in 
standards, another group?


More information about the es-discuss mailing list