typeOf(arguments) with "use strict" #2447

Closed
arian opened this Issue Nov 22, 2012 · 10 comments

Projects

None yet

3 participants

@arian
Member
arian commented Nov 22, 2012

Array.from uses .callee, which generates an error when the code (so not mootools itself) where Array.from is used, uses "use strict".

http://jsfiddle.net/FEcXE/

@arian
Member
arian commented Nov 22, 2012

it is actually typeOf: http://jsfiddle.net/FEcXE/1/

@kentaromiura
Member

using constructor like you said seems to work, tested on ie8, i8/7 standard mode & quirk(6)
http://jsfiddle.net/kentaromiura/FEcXE/2/

@kentaromiura
Member

Actually after thinking about it, the arguments.constructor is Object, so alert(typeOf({length:3})); will fail :(
👎

I can only suggest to check for checking the Object.prototype.toString, that in all the new browsers return [object Arguments] apart for... guess which browser :P

@kentaromiura
Member

this will solve the problem:
http://jsfiddle.net/kentaromiura/FEcXE/7/

@arian
Member
arian commented Nov 23, 2012

it doesn't entirely: http://jsfiddle.net/FEcXE/8/

On Fri, Nov 23, 2012 at 9:54 AM, Cristian Carlesso <notifications@github.com

wrote:

this will solve the problem:
http://jsfiddle.net/kentaromiura/FEcXE/7/


Reply to this email directly or view it on GitHubhttps://github.com/mootools/mootools-core/issues/2447#issuecomment-10653285.

@kentaromiura
Member

in IE it outputs
object, object, arguments.

@arian
Member
arian commented Nov 23, 2012

It outputs object, object, object in chrome...

On Fri, Nov 23, 2012 at 10:12 AM, Cristian Carlesso <
notifications@github.com> wrote:

in IE it outputs
object, object, arguments.


Reply to this email directly or view it on GitHubhttps://github.com/mootools/mootools-core/issues/2447#issuecomment-10653665.

@arian
Member
arian commented Dec 4, 2012

So this: https://gist.github.com/4163041/2c2cd1e59e107b01fdb89bb26b439e6f10e79053
or just remove the if (item.callee) return 'arguments'; line!

@kentaromiura
Member

I vote for removal.
but we can simplify that @WebReflection snippet a bit, since we already have our pre-checks.

@WebReflection

here the gist for isArguments that works with use strict too, if this is what kenta meant: https://gist.github.com/4163041

@arian arian added a commit to arian/mootools-core that referenced this issue Dec 21, 2012
@arian arian Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
c7bd8ff
@arian arian closed this in 89167e8 Feb 11, 2013
@arian arian added a commit to ibolmo/mootools-core that referenced this issue Feb 16, 2014
@arian @ibolmo arian + ibolmo Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
49003b1
@arian arian added a commit to timwienk/mootools-core that referenced this issue Feb 23, 2014
@arian @timwienk arian + timwienk 1.4 specs for #2447 (see commit 89167e8). 6dc60d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment