W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Alex Russell <slightlyoff@google.com>
Date: Mon, 31 Oct 2011 16:26:05 -0700
Message-ID: <CANr5HFURPQ5utrsMt1FFQDuULNDELD6PA0Lryned8wn8zoRgdg@mail.gmail.com>
To: Charles Pritchard <chuck@jumis.com>
Cc: public-webapps@w3.org
On Mon, Oct 31, 2011 at 2:18 PM, Charles Pritchard <chuck@jumis.com> wrote:
> On 10/31/11 2:03 PM, Cameron McCormack wrote:
>>
>> On 31/10/11 1:56 PM, Alex Russell wrote:
>>>
>>> Live NodeList instances don't need to be considered here. They're the
>>> result of an API which generates them, and that API can be described
>>> in terms of Proxies. No need to complicate NodeList or imply that we
>>> need a different type.
>>>
>>> Making NodeList instances real array unifies them all. We can get that
>>> done too.
>>
>> Don't live and static NodeLists use the same prototype?  If they are
>> separate, I don't see any problem with making them "real arrays", but I am
>> not sure what the implications of that are.  Array.isArray == true, I guess?
>>  Do we have that ability within the bounds of ECMAScript yet? Note that we
>> can already make NodeList.prototype === Array.prototype if we want, using
>> appropriate Web IDL annotations.
>
> Array seems to work fine in WebKit:
> document.getElementsByTagName('div').__proto__.__proto__ = Array.prototype;
>
> dojo just reimplements NodeList as an array:
> http://dojotoolkit.org/reference-guide/dojo/NodeList.html

The reason we did it that way is because there's no other way to
create an intermediate type with the magic ".length" property.

> I don't understand what "real array" means, other than the prototype
> equivalence.
>
> If NodeList were an array, what's the behavior of running push on NodeList?
> The list may end up with non-node objects if push is not supplemented.
>
> -Charles
>
>
>
Received on Monday, 31 October 2011 23:27:11 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT