Opened 12 years ago

Closed 12 years ago

#3658 closed defect (worksforme)

typeof parameters depends on kind of widget creation

Reported by: guest Owned by: bill
Priority: high Milestone: 0.9
Component: Dijit Version: 0.4.2rc1
Keywords: widget typeof parameters Cc:
Blocked By: Blocking:

Description

Version 0.4.3 (8617): typeof parameters depends on kind of widget creation: a numerical parameter is typeof "object" if created declarative, but is typeof "number" if created programmatically. It's a little bit confusing.

Attachments (1)

minimizer.html (1.3 KB) - added by bill 12 years ago.
testcase showing that it works correctly, at least for 0.9

Download all attachments as: .zip

Change History (4)

comment:1 Changed 12 years ago by bill

You'll have to give more information and a testcase; I'm not sure what you are referring to. When widgets are created declaratively all the parameters are specified as strings, but they get converted to the correct types as specified by the widget. When creating programatically you are required to pass in the correct types (no conversion happens). At least for 0.9.

comment:2 Changed 12 years ago by guest

I created a widget declarative like this:

<DIV

dojoType="ht:Minimizer" hasContent="1" scaleAxis="width" scaleFactorOnEvent="0" minimizeToWidth="150" stretchMinimizer="1" ...

</DIV>

In ht:Minimizer I defined the types

scaleAxis : "auto", scaleFactorOnEvent : 0, minimizeToWidth : 0, minimizeToHeight : 0, stretchMinimizer : 1, hasContent : 0,

Now in the module typeof(scaleFactorOnEvent) is "object".

If I create the widget programmatically

var args = {

scaleAxis : "auto", scaleFactorOnEvent : 0, minimizeToWidth : 0, minimizeToHeight : 0, stretchMinimizer : 1, hasContent : 0,

} dojo.widget.createWidget("ht:Minimizer", args, div )

typeof(scaleFactorOnEvent) is "number".

Hope things are more clear now. Thanks.

Changed 12 years ago by bill

Attachment: minimizer.html added

testcase showing that it works correctly, at least for 0.9

comment:3 Changed 12 years ago by bill

Milestone: 0.9
Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.