PDA

View Full Version : [FIXED][3.0RC1] Container.add breaks the inheritance model



jacombs
30 Apr 2009, 3:16 AM
Between 2.2.1 and 3.0RC1, someone changed the Container.add method from this in 2.2.1:


add : function(comp){
this.initItems();
var a = arguments, len = a.length;
if(len > 1){
for(var i = 0; i < len; i++) {
this.add(a[i]);
}
return;
}
var c = this.lookupComponent(this.applyDefaults(comp));
var pos = this.items.length;
if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
this.items.add(c);
c.ownerCt = this;
this.fireEvent('add', this, c, pos);
}
return c;
},

... to this in 3.0RC1


add : function(comp){
this.initItems();
var a = arguments, len = a.length;
if(len > 1){
for(var i = 0; i < len; i++) {
Ext.Container.prototype.add.call(this, a[i]);
}
return;
}
var c = this.lookupComponent(this.applyDefaults(comp));
var pos = this.items.length;
if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
this.items.add(c);
c.ownerCt = this;
this.fireEvent('add', this, c, pos);
}
return c;
},
Why is it now making a hard-wired call to the add method instead of a recursive call?
Now if you override the add method, you only sort of override it which makes things kind of confusing.

evant
30 Apr 2009, 4:01 PM
I've reverted this change, seems may have been committed by accident.