#16104 closed defect (wontfix)
array.indexOf casts false values (uses == not ===)
Reported by: | juk | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Core | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dojo/_base/array.indexOf uses weak typing and is not consistent with Array.indexOf:
[""].indexOf(false) == -1 [""].indexOf(0) == -1 [undefined].indexOf(null) == -1
array.indexOf([""], false) == 0 array.indexOf([""], 0) == 0 array.indexOf([undefined], null) == 0
Change History (7)
comment:1 follow-up: 2 Changed 10 years ago by
comment:2 Changed 10 years ago by
Replying to mm:
3 days, core function, no reply.
Thanx for interest !
Friday... Saturday... Sunday... we are all volunteers, you should not expect immediate 24hr response on the weekends ;)
It will get looked at ASAP.
comment:3 Changed 10 years ago by
the dojo/_base/array
functions' behavior do not match 1:1 with the native Array methods of the same names (partially because, if I recall correctly, the former pre-date the latter). One example that comes up often is in how the iterative methods treat sparse arrays.
I would figure this is not a "bug" that would be "fixed", due to how it would change behavior that code written by users of Dojo 1.0+ may have been relying upon for years, whether intentionally or not.
Dojo 2.0 will probably do away with these methods in favor of something like es5shim.
comment:4 Changed 10 years ago by
comment:5 Changed 10 years ago by
Summary: | array.indexOf casts false values → array.indexOf casts false values (uses == not ===) |
---|
comment:6 Changed 9 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Personally I'd like to have this fixed. But I brought this up on http://thread.gmane.org/gmane.comp.web.dojo.devel/18442 and most people don't want to change the current behavior. And since the array module will likely disappear completely for 2.0, marking this as wontfix.
3 days, core function, no reply.
Thanx for interest !