[Dojo-interest] Tooltips missing after porting from 1.6 to 1.7

Bill Keese bill at dojotoolkit.org
Mon May 21 16:15:58 EDT 2012

On Tue, May 1, 2012 at 3:16 AM, Ron M <maccrack at centricsoftware.com> wrote:

> While porting from 1.6 to 1.7 I found that the tooltips on some widgets
> were
> missing. It turns out that this happened on widgets that I had subclassed
> such as below:
> dojo.declare("my.widget", dijit.form.Button, {
>    title: "My Title"
> });
> or
> dojo.declare("my.widget", dijit.form.Button, {
>    postMixInProperties: function() {
>        this.title = "My Title";
>    }
> });

Hmm, looks like that should work.   The code calls _setXXXAttr() for any
attributes with non-falsy values.

> I read there was a change to how attributeMap and the _setXXXAttr functions
> work, so I dug in and found that when a widget is first built that the
> _setXXXAttr functions are only called on properties found in this.params.

Here's the code from _WidgetBase, notice the first section:

// Call this.set() for each attribute that was either specified as
parameter to constructor,
// or was found above and has a default non-null value. For correlated
attributes like value and displayedValue, the one
// specified as a parameter should take precedence, so apply attributes in
this.params last.
// Particularly important for new DateTextBox({displayedValue: ...}) since
DateTextBox's default value is
// NaN and thus is not ignored like a default value of "".
array.forEach(list, function(attr){
if(this.params && attr in this.params){
// skip this one, do it below
}else if(this[attr]){
this.set(attr, this[attr]);
}, this);
for(var param in this.params){
this.set(param, this.params[param]);

> I have been able to fix my problems after figuring this out, but that leads
> me to a few general questions about best practices with widgets and
> _setXXXAttr functions:
> 1) Are either of these cases above supposed to work? In other words, is
> there a defect here?

See above.

> 2) At what point in the widget lifecycle is widget.set("x", x) supposed to
> work? I have found a few cases where it gives a javascript error if called
> from postMixInProperties (and maybe either places). Calling them in
> postCreate seems to work fine.
Yah, currently a lot of the methods depend on the DOM having already been

3) Is there anything stated about this in the docs somewhere? If not, I
> think there should be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20120522/b40c11b1/attachment.htm 

More information about the Dojo-interest mailing list