W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2011

problems with 4.2.19 Arrays

From: David Flanagan <dflanagan@mozilla.com>
Date: Fri, 27 May 2011 12:03:08 -0700
Message-ID: <4DDFF56C.40304@mozilla.com>
To: public-script-coord@w3.org
First of all, a typo:
> Array host objects MUST always have a property named ToString(i) for 
> every integer index 0 < i < n, where n is the length of the array.
That first < should be <=.

More importantly this section says that the index properties and the 
length property of readonly arrays must be configurable: false.

DOM Core says that the attributes property of an Element object is a 
readonly Attr[]. Historically (I'm not sure if DOM Core mandates this, 
though) each reference to the attributes property returns the same 
object.  And although user code cannot change the length or set the 
elements, those may change between accesses.  That is, the attributes 
object is live.   I can't implement live but non-configurable properties 
in JavaScript (even with Proxies).  And I can't implement it in C++ 
without violating 8.6.2 of the ECMA-262 spec.

3.7.18 of WebIDL says:

> Arrays can either be fixed length or variable length. Fixed length 
> arrays cannot have their length changed by user code after they have 
> been created, while variable length arrays can. Unless otherwise 
> specified, arrays are fixed length.
>
> Arrays can also be designated as being read only. User code cannot 
> modify the values of read only array elements. If an array is read 
> only, then it is also implicitly fixed length 
> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-fixed-length>.
>

Since this text explicitly mentions user code, I suspect that live 
read-only-but-unfrozen arrays are supposed to be possible and that this 
is simply a bug in WebIDL.

On the other hand, maybe DOM Core just needs to change attributes back 
to a NamedNodeMap?

     David
Received on Friday, 27 May 2011 19:03:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:03 UTC