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

On 10/20/11 10:23 AM, Alex Russell wrote:
> On Thu, Oct 20, 2011 at 3:14 PM, Boris Zbarsky<bzbarsky@mit.edu>  wrote:
> Right. So you need to vend an apparently-immutable Array, one which
> can only be changed by the browser. I think that could be accomplished
> in terms of Proxies. But it's still an Array type.

I have no problem with Array being on the prototype chain or whatnot. 
But it's not "an array" in the sense that you can't do a bunch of things 
with it that people do with arrays.

>> Though I don't know what "slots" you're talking about; the only sane JS
>> implementation of live nodelists is as a proxy.  There's no way to get the
>> behaviors that browsers have for them otherwise.
>
> But it can be a Proxy to an *Array*, not to some weird non-Array type.

Why does it matter what it's a proxy to?  The whole point of being a 
proxy is that you can't tell what it's proxying.

Case in point, in Gecko it's a proxy to something that's not a JS object 
at all and not even implementable in JS (because it uses internal engine 
information that's not available to JS).

So what exactly do you want here other than nodelists having 
Array.prototype on their prototype chain, which is discussed elsewhere?

And again, for static nodelists none of this applies; there's absolutely 
no reason I can think of to not make them arrays, unless you really want 
a .item() on them or unless you really think the length getter should be 
hookable.

-Boris

Received on Thursday, 20 October 2011 14:30:20 UTC