Opened 12 years ago

Closed 12 years ago

#4623 closed defect (invalid)

Form widgets dom class is lost on first mouseover

Reported by: guest Owned by:
Priority: high Milestone:
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

HOW TO REPRODUCE:

Go to http://82.230.65.68:31416/~fred/dojo/fred_samples/bug_008.html
There is a large button (at least under Firefox OSX)
Mouse over the button labelled "Created in HTML"


RESULT:

The button change size


EXPECTED RESULT:

The button don't change size


COMMENT:

This is a regression from #4584, starting at r10644. The issue is that the current content of the domNode.className is stored in staticClass ivar (in dijit.form._FormWidget.setStateClass) at widget creation time, and the content of that instance variable is used to replace the content.


The second button shows that via javascript, setting the class before creating the widget don't work (this is not a regression, I didn't worked before).
This render the issue serious, because it prevent setting classes on javascript created widgets.

Change History (1)

comment:1 Changed 12 years ago by bill

Resolution: invalid
Status: newclosed

This is expected behavior. We don't support changing the class of a widget's dom node after creating the widget. So the

dojo.addClass( dijit.byId( "btn" ).domNode, "large" );

is invalid. You could hack it by modifying widget.staticClass to match your modifications to the widget's dom node.

As for the programmatic creation, you need to specify the class as an argument to the constructor. Ex:

new dijit.form.Button({ "class": "large", style: "color: red" });

I'll update the manual/porting notes with this info.

Note: See TracTickets for help on using tickets.