id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blocking,blockedby
7037,Duplicate mouseover and mouseout events added to cloned element.,patrickwhalen,dmethvin,"When cloning an element that has mouseenter or mouseleave events, the clone will receive a duplicate mouseover and mouseout event causing the handler to double-fire.

So if the jQuery.cache shows this for the original:

mouseenter: Array(1)

mouseover: Array(1)

mouseleave: Array(1)

mouseout: Array(1)

the clone will have:

mouseenter: Array(1)

mouseover: Array(2)

mouseleave: Array(1)

mouseout: Array(2)

-------

Test: http://jsfiddle.net/9y7tp/


    // The hover for the original element will toggleClass the ""blue"" class properly and show one alert.

    // The hover for the clone double-fires the handler, so the toggleClass is called again, and you get 2 alerts.

var $hoverbox = $('.hover').hover(function(e) {
      $('#box').toggleClass('blue');

      alert(e.type);
});

$hoverbox.clone(true).text(""Hover clone"").appendTo('body');

",bug,closed,blocker,1.7,manipulation,1.4.2,fixed,"clone,events,mouseover,mouseout,1.7-discuss",,,
