Commit 375b7878 authored by jeresig's avatar jeresig

The default for .clone() is to not clone any events. Fixes #8123.

parent eb5aab99
...@@ -184,7 +184,7 @@ jQuery.fn.extend({ ...@@ -184,7 +184,7 @@ jQuery.fn.extend({
}, },
clone: function( dataAndEvents, deepDataAndEvents ) { clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? true : dataAndEvents; dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () { return this.map( function () {
......
...@@ -953,6 +953,17 @@ test("clone()", function() { ...@@ -953,6 +953,17 @@ test("clone()", function() {
div.remove(); div.remove();
clone.remove(); clone.remove();
var divEvt = jQuery("<div><ul><li>test</li></ul></div>").click(function(){
ok( false, "Bound event still exists after .clone()." );
}),
cloneEvt = divEvt.clone();
// Make sure that doing .clone() doesn't clone events
cloneEvt.trigger("click");
cloneEvt.remove();
divEvt.remove();
// this is technically an invalid object, but because of the special // this is technically an invalid object, but because of the special
// classid instantiation it is the only kind that IE has trouble with, // classid instantiation it is the only kind that IE has trouble with,
// so let's test with it too. // so let's test with it too.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment