I think older browser's apply accept both arrays and genuine arguments, but not array-like objects that were neither. IIRC, there were some circumstances where we were passing in an emulated arguments object which was just an array-like object that was neither. On older browser's apply, these emulated arguments objects are rejected.
Alternatively, if the "apply" we're calling might be a user-supplied apply method rather than the original built in one, for example because the user overrode it on a function instance, then we still need to convert for the reason Ihab mentions, to prevent cajoled code from getting a direct reference to a non-strict arguments objects. This is more than belt and suspenders -- this is a hard requirement. On Tue, May 8, 2012 at 4:36 PM, <[email protected]> wrote: > I believe this practice was a belt and suspenders way to sanitize out > weird stuff like "arguments.caller"; "arguments.callee"; etc. -- Ihab > > > On Tue, May 8, 2012 at 4:27 PM, Mike Stay <[email protected]> wrote: > >> In some places in es53.js, we have >> m.apply(obj, arguments) >> or >> m.f___(obj, arguments) >> but in others, we have >> m.apply(obj, slice.call(arguments, 0)). >> >> I can't remember why we convert the arguments object to an array. Can >> anyone remind me? Do older browsers' "apply" methods have trouble >> with a non-array object or something? >> -- >> Mike Stay - [email protected] >> http://www.cs.auckland.ac.nz/~mike >> http://reperiendi.wordpress.com >> > > > > -- > Ihab A.B. Awad, Palo Alto, CA > -- Cheers, --MarkM
