PDA

View Full Version : [BUG] toggleCls method throwing error [4.1 PR]



Stoot98
25 Oct 2011, 12:52 AM
Hi Guys,

Not sure what sort of reports you guys want as I know there are still known issues so ignore this if you have it covered!

I have come across a small bug with the toggleCls method of the Ext.dom.AbstractElement class.

It's just a small problem where the variable name doesn't match up.
On line 11017 (of ext-all-debug.js):


dom.classList.toggle(name);

..should read:


dom.classList.toggle(className);

Here's a drop-in override should anyone else come across this problem...


Ext.dom.AbstractElement.override({ toggleCls: Ext.supports.ClassList ?
function (className) {
var me = this,
dom = me.dom;


if (dom) {
className = className.replace(/^\s+|\s+$/g, '');
if (className) {
dom.classList.toggle(className);
}
}


return me;
} :
function(className) {
var me = this;
return me.hasCls(className) ? me.removeCls(className) : me.addCls(className);
}
});

Anyways, great work with the new release!

Cheers
Stuart

dongryphon
26 Oct 2011, 7:39 AM
Great bug report thanks! Fix applied :)