Opened 13 years ago
Closed 13 years ago
#7084 closed defect (invalid)
dojo.isArray([]) returns false in webkit/safari
Reported by: | Sam Foster | Owned by: | anonymous |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | Core | Version: | 1.1.1 |
Keywords: | Cc: | alex | |
Blocked By: | Blocking: |
Description
Since I'm not sure when, dojo.isArray([]) returns false in Safari 3.1.1 (mac) and the webkit currently bundled in AIR. This is because [] instanceof Array returns false (which is surely a webkit bug???)
So this test case fails: true == dojo.isArray(["some", "values"];
Change History (12)
comment:1 Changed 13 years ago by
comment:3 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Yeah, I just tried it on Safari on windows, and on another mac - worked just fine in both . Somehow (worryingly) my safari/webkit javascript engine has gotten screwed up. I'll close as invalid and re-open if I find a meaningful way to reproduce
comment:4 Changed 13 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I started looking at this ticket because I ran into this same behavior. On two different Macs (one running Safari 3.1 and the other Safari 3.1.2) I get
> [] instanceof Array false
Also, note that on both FF3 and Safari 3, typeof it
is "object"
and not "array"
Checking dojo.isObject() on an array always returns true on both FF3 and Safari. (Is that correct behavior?)
It appears that dojo.isArrayLike() returns true for both [] and Array on Safari. So it appears that the current dojo.isArray isn't reliable on Safari 3.
comment:5 Changed 13 years ago by
A further note, this evaluates to true on both FF3 and Safari 3:
>>> (new Array) instanceof [].constructor true
And obviously this does too:
>>> [] instanceof [].constructor true
(Or maybe it isn't so obvious, considering the twisted nature of this bug.)
comment:6 Changed 13 years ago by
Milestone: | → 1.2 |
---|
comment:7 Changed 13 years ago by
Well, I'm now running 3.1.2 and I still get true for [] instanceof Array and for dojo.isArray([]). What are we doing differently? Dylan, can you reproduce this?
comment:9 Changed 13 years ago by
ok, fwiw, I'm on Tiger, and this would be the second time I've seen Safari behave differently on Tiger vs. Leopard.
comment:10 Changed 13 years ago by
ok, even stranger... within Safari's Web Inspector, both return false, but with window.alert, they both return true, with Safari 3.1.2 on Leopard.
comment:11 Changed 13 years ago by
sfoster, bitranch, can you include a test case with specific setup info? Is it possible this is just an artifact of tools or iframes or something of that sort? I know you can get in a situation like this if you compare types across iframes, for example. And if we can prove this is a Safari bug, we should file something in their bugzilla for investigation, but I can't see it yet.
comment:12 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
I suggest we come up with a real (web page-based) test case. If it's limited to safari's web inspector, and can be reproduced without Dojo (e.g. [] instanceof Array is false) then I suggest we file a bug with webkit instead.
I tried patching lang.js, dojo.isArray to use
but this too returns false for me, for reasons I'm struggling to understand.