Why not NodeList#forEach :\?

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jun 19 08:37:36 PDT 2012

On Jun 19, 2012, at 5:29 AM, David Bruant wrote:

> Le 19/06/2012 14:11, Alex Russell a écrit :
>> ...
>> 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)

Actual API "design" is probably an orthogonal issue.  What the "Object Model Reformation" proposal (which is probably better understood by its subtitle "Decoupling [ ] and Property Access") does is permit the existing behavior of DOM collections to be directly expressed in JavaScript without having having to resort to host object magic.  It supports the general principle of: If the DOM needs to do it then it should be doable in pure JavaScript.  There are lots of reasons why for some objects it makes sense for "indexed access" to have different semantics than "property access".  The DOM does this today. In an improved DOM API design it will probably also be the case.  The Object Model Reformation provides a semantic basis for designing such improved APIs rather than just making up host object magic that has no foundation in core JavaScript semantics.


More information about the es-discuss mailing list