Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-10-19 08:10:50

hugob
New member
Registered: 2005-10-19
Posts: 2

Using Xinha with other Javascript libraries (problem with cloning)

I have three JS libraries.
Xinha works fine stand alone
The other two (a dhtml tree and the Ajax Prototype library) work fine (also together)
But wen I combine these two with Xinha, Xinha stops working, both in IE and FF.
This also happens with one of the other two and Xinha.
I could find the following piece of code in one of these libraries that causes the trouble for Xinha:

Object.prototype.clone = function(){
function _dummy(){};
_dummy.prototype=this;
return new _dummy;
};

Probably the other library has a similar piece of code. What happens is the following: the "dummy" function is added to a number of arrays in Xinha like the btn array. And then an error occurs during an iteration over the array.
So I could fix the problem by adding about ten times something like:
if (typeof item != 'function') {.....
}
So it is working now, but it is a quick and dirty solution. Why is these function added to the arrays (sorry, I am not a JS expert)? Who is to blame, Xinha or both the other libs?

thanks

Hugo

Offline

Board footer

Powered by FluxBB