PDA

View Full Version : 1.1.0 Ext.List addCls Documentation Error



benwhite
18 Aug 2011, 4:42 AM
The documentation for Ext.List methods addCls and removeCls indicate that they take no parameters.
Actually, they take n parameters of string classnames.

*edit: sorry I should have indicated this was an error with Ext.lib.Component documentation

mchambaud
4 Jan 2012, 12:37 PM
Yup...


/**
* Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
* @param {String/Array} className The CSS class to add, or an array of classes
* @return {Ext.Element} this
*/
addCls: function(className) {
var me = this,
i,
len,
v,
cls = [];

if (!Ext.isArray(className)) {
if (className && !this.hasCls(className)) {
me.dom.className += " " + className;
}
}
else {
for (i = 0, len = className.length; i < len; i++) {
v = className[i];
if (v && !me.hasCls(v)) {
cls.push(v);
}
}
if (cls.length) {
me.dom.className += " " + cls.join(" ");
}
}
return me;
},

line 19736