bug on jQuery.clone(true) ?

bug on jQuery.clone(true) ?

Hi,

just try to execute this simple code :

Array.prototype.test=function(){alert('test')};
var elt=jQuery('<div>').click(jQuery.noop).clone(true);
elt.click();



When you trigger the 'click' event on the cloned element, the 'test' method is executed !

testing in jsbin :
http://jsbin.com/urite/2

It seems that any method that has been added to the 'Array' object (before cloning, of course) will be executed when any event is triggered. This is not the case if you bind the event after cloning :

Array.prototype.test=function(){alert('test')};
var elt=jQuery('<div>').clone().click(jQuery.noop);
elt.click();




testing : http://jsbin.com/urite/3

My conclusion : it deals with the 'clone' mecanism when events are cloned

I don't know enough the jQuery mecanism to understand if this is normal or it is a bug.

Can anybody take a look on this topic and validate or not my conclusion ?

version : jQuery 1.4.2
browsers : FF 3.6.10, IE7

Thanks.

Emile
uses gigatransfert.com