Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

typeOf(arguments) with "use strict" #2447

Closed
arian opened this Issue · 10 comments

3 participants

@arian
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
Owner

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

@kentaromiura
Collaborator

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

@kentaromiura
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

@kentaromiura
Collaborator

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

@arian
Owner
@kentaromiura
Collaborator

in IE it outputs
object, object, arguments.

@arian
Owner
@arian
Owner

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

@kentaromiura
Collaborator

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 referenced this issue from a commit in arian/mootools-core
@arian arian Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
c7bd8ff
@arian arian closed this in 89167e8
@arian arian referenced this issue from a commit in ibolmo/mootools-core
@arian arian Fixes #2447 - Using 'callee' in item, instead of item.callee, which t…
…hrew an error
49003b1
@arian arian referenced this issue from a commit in timwienk/mootools-core
@arian 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.