Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

typeOf(arguments) with "use strict" #2447

Closed
arian opened this Issue · 10 comments

3 participants

Arian Stolwijk Cristian Carlesso Andrea Giammarchi
Arian Stolwijk
Owner

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 Stolwijk
Owner

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

Cristian Carlesso
Collaborator

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

Cristian Carlesso
Collaborator

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

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

Cristian Carlesso
Collaborator

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

Arian Stolwijk
Owner
Cristian Carlesso
Collaborator

in IE it outputs
object, object, arguments.

Arian Stolwijk
Owner
Arian Stolwijk
Owner

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

Cristian Carlesso
Collaborator

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

Andrea Giammarchi

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

Arian Stolwijk arian referenced this issue from a commit in arian/mootools-core
Arian Stolwijk arian Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
c7bd8ff
Arian Stolwijk arian closed this in 89167e8
Arian Stolwijk arian referenced this issue from a commit in ibolmo/mootools-core
Arian Stolwijk arian Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
49003b1
Arian Stolwijk arian referenced this issue from a commit in timwienk/mootools-core
Arian Stolwijk arian 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
Something went wrong with that request. Please try again.