PDA

View Full Version : [1.1.1][SOLVED] Dom.hasClass not defined



leemhenson
15 Oct 2007, 4:48 AM
Hi,

I'm using 1.1.1 with the prototype adapter (using the prototype + scriptaculous libraries included in the adapter folder), and I'm getting an error in the isValidHandleChild function within Ext.dd.DragDrop @ line 8022 of ext-debug-all.js.

Original version:


isValidHandleChild: function(node) {

var valid = true;

var nodeName;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}
valid = valid && !this.invalidHandleTypes[nodeName];
valid = valid && !this.invalidHandleIds[node.id];

for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
}


return valid;

}

My change:


isValidHandleChild: function(node) {

var valid = true;

var nodeName;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}
valid = valid && !this.invalidHandleTypes[nodeName];
valid = valid && !this.invalidHandleIds[node.id];

for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
}


return valid;

}

This seems to have fixed it, though I'm interested to know whether this is just a bug or a sympton of invalid configuration I may have supplied somewhere else.

Cheers
Lee

mystix
15 Oct 2007, 5:12 AM
verified. it's a bug in Ext 1.1.1 (probably a legacy leftover from the YUI-ext days, since Dom.hasClass() is actually a YUI method).

use this instead in your overrides file in the meantime


Ext.override(Ext.dd.DragDrop, {
isValidHandleChild: function(node) {
var nodeName, valid = true;
// var n = (node.nodeName == "#text") ? node.parentNode : node;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}

valid = valid && !this.invalidHandleTypes[nodeName] && !this.invalidHandleIds[node.id];

for (var i = 0, len = this.invalidHandleClasses.length; valid && i < len; ++i) {
valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
}

return valid;
}
});

leemhenson
15 Oct 2007, 5:29 AM
Cheers.

"Overrides file". That sounds like a better idea than hacking my ext-all file to bits. :)

mystix
15 Oct 2007, 5:53 AM
definitely. that way once it's fixed in the official build all you have to do is remove the patch from your overrides file.

enjoy ;)

mystix
22 Oct 2007, 9:42 AM
[ bump ]
one for the radar...