Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#16312 closed defect (duplicate)

_applyAttributes does not call a setter if the defined value is falsy

Reported by: Colin Snover Owned by: bill
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:


In _WidgetBase._applyAttributes:

		// Step 2: Call set() for each property that wasn't passed as a parameter to the constructor
		array.forEach(list, function(attr){
			if(attr in params){
				// skip this one, do it below
			}else if(this[attr]){
				this.set(attr, this[attr]);
		}, this);

if this[attr] is set but is a falsy value, the setter is never called. I’m not entirely sure why there is a check here at all for this. These lines were introduced in

Change History (3)

comment:1 Changed 10 years ago by bill

Resolution: duplicate
Status: newclosed

Duplicate of #14341.
I'll update the comment until that's fixed.

comment:2 Changed 10 years ago by Colin Snover

Well, it seems like #14341 turned into a duplicate because Christophe used it for two different related issues, so I guess this is more like a duplicate of #7381? Anyway, let me know which ticket you want me to use for additional comments. I’m aware there are people relying on this conditional (see the several bugs I opened today on dojox/mobile), but I’m not sure that means that this shouldn’t be fixed in a 1.x release, because it seems a lot like it is a huge defect in the way property setters are called when defining default values.

comment:3 Changed 10 years ago by bill

Ah right, I meant to say it was a dup of #7381, so please add comments there.

Note: See TracTickets for help on using tickets.