About _fillContent() of "dijit.form.Button".

View: New views
1 Messages — Rating Filter:   Alert me  

About _fillContent() of "dijit.form.Button".

by Sangpil Byun-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi~

I have a question about "dijit.form.Button".

Why does "_fillContent()" use label value from "this.params"?

Code is here.
_fillContent: function(/*DomNode*/ source){
        // Overrides _Templated._fillContent().
        // If button label is specified as srcNodeRef.innerHTML rather than
        // this.params.label, handle it here.
        if(source && (!this.params || !("label" in this.params))){
                this.attr('label', source.innerHTML);
        }
},

this.params was already mixin with button's instance.
In this case,
if someone make dijit.form.Button's subClass - override
postMixInProperties() method for change the label value,
like this,

postMixInProperties() {
  this.label = "HAHAHA";
  this.inherited(arguments);
},

then, this label(="HAHAHA") don't show on Button's label.

I think the condition statement of "_fillContent " should be change like this.

if(source && !this.label) {
        this.attr('label', source.innerHTML);
}

Thank you.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest