Array.prototype.slice web-compat issue?
waldron.rick at gmail.com
Tue Sep 10 15:24:34 PDT 2013
On Tue, Sep 10, 2013 at 1:37 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> I see one of two problems mentioned in my other topic is already discussed
> here so I'd like to add this question that will most likely break the web:
> 1. will `.slice.call(arguments)` produce a pointless instanceof
> Arguments ?
No, because you can't construct `new Arguments()` (Arguments is undefined),
leaving A undefined at step 15.c, which means step 16 evaluates to true,
which leads to 16.a and that produces an Array.
> 2. will `.slice.call(document.querySelectorAll('*'))` produce an
> instanceof Static NodeList ?
This is a good question, if NodeList has an internal [[Construct]] it will
pass the IsConstructor test and then throw a TypeError exception as soon as
15.c.i occurs. Based on my interpretation of the steps in
OrdinaryConstruct, it wouldn't survive. Maybe Allen can clarify?
Also, this is the exact pain point case that Array.from was designed to
address, but existing code shouldn't break in the interim.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss