Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15012 closed defect (fixed)

getType in MVC (inconsistent behavior in MSIE and Others)

Reported by: mm Owned by: Ed Chatelain
Priority: undecided Milestone: 1.8
Component: DojoX MVC Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

getType: function(/*Anything*/ v){

summary: Returns the type of the given value. v: Anything The value.

return lang.isArray(v) ? "array" : {}.toString.call(v) == "[object Object]" ? "object" : "value";

},

test this line for null in MSIE and Others {}.toString.call(v)

I believe it shall return "value" in all browsers. in MSIE it returns "object".

Please check also other occurrences of this pattern {}.toString.call(v) in mvc/*.

And let us know.

Consistent behavior is important for input widgets that make difference between null and "" values.

Change History (9)

comment:1 Changed 7 years ago by ben hockey

Object(v) === v might be useful in this case - it returns false for all primitive values (null, undefined, boolean, string, number)

comment:2 Changed 7 years ago by mm

Please any hope for fix ?

comment:3 Changed 7 years ago by ben hockey

it was just applied - see #14681. i'll leave this for edchat to close this ticket when he's ready.

comment:4 Changed 7 years ago by Ed Chatelain

A fix is in, but I am going to be tweaking it a little bit.

comment:5 Changed 7 years ago by mm

re: neon, to your first post: I'm affraid that simple if v== null would be more appropriate, if null and undefined are supplied to Object(v), it creates useless object just to find that null and undefined "is primitive" (which is incorrect statement again ;-))) BTW ;-)

comment:6 Changed 7 years ago by ben hockey

mm - see https://github.com/edchat/dojox_mvc/pull/29 for more of the discussion.

comment:7 Changed 7 years ago by Ed Chatelain

Resolution: fixed
Status: newclosed

This is now fixed.

comment:8 Changed 7 years ago by bill

Milestone: tbd1.8

comment:9 Changed 7 years ago by Ed Chatelain

The fix went in with changeset [28183]:

Note: See TracTickets for help on using tickets.