gcsolaroli
10 Nov 2006, 2:01 AM
Digging on the ComponentElement.js file, I found some other code that didn't look perfectly sound
YAHOO.ext.CompositeElementLite = function(els){
this.elements = [];
this.addElements(els);
this.el = YAHOO.ext.Element.get(this.elements[0], true);
};
There is nothing wrong with this constructor, but I think it would be more correct to write it like this, wouldn't it?
YAHOO.ext.CompositeElementLite = function(els){
YAHOO.ext.CompositeElementLite.superclass.constructor.call(this, els);
this.el = YAHOO.ext.Element.get(this.elements[0], true);
};
There is also a subtle inconsistency in the YAHOO.ext.CompositeElementLite.addElements implementation.
YAHOO.ext.CompositeElementLite
addElements : function(els){
if(!els) return this;
this.elements = this.elements.concat(els);
},
This code does not return anything when some elements are passed, whereas in all other condition (even in the YAHOO.ext.CompositeElement.addElement) 'this' is always returned.
This could be easily fixed:
YAHOO.ext.CompositeElementLite
addElements : function(els){
if (els) {
this.elements.concat(els);
}
return this
},
YAHOO.ext.CompositeElementLite = function(els){
this.elements = [];
this.addElements(els);
this.el = YAHOO.ext.Element.get(this.elements[0], true);
};
There is nothing wrong with this constructor, but I think it would be more correct to write it like this, wouldn't it?
YAHOO.ext.CompositeElementLite = function(els){
YAHOO.ext.CompositeElementLite.superclass.constructor.call(this, els);
this.el = YAHOO.ext.Element.get(this.elements[0], true);
};
There is also a subtle inconsistency in the YAHOO.ext.CompositeElementLite.addElements implementation.
YAHOO.ext.CompositeElementLite
addElements : function(els){
if(!els) return this;
this.elements = this.elements.concat(els);
},
This code does not return anything when some elements are passed, whereas in all other condition (even in the YAHOO.ext.CompositeElement.addElement) 'this' is always returned.
This could be easily fixed:
YAHOO.ext.CompositeElementLite
addElements : function(els){
if (els) {
this.elements.concat(els);
}
return this
},