Because you're returning the original instead of the clone. Use this instead:
$.fn.cloneDumpingEvents = function () {
var collection = $();
this.each(function() {
collection = collection.add( $(this).clone() );
});
return collection;
};
Here's your fiddle: http://jsfiddle.net/dCm59/4/
As pointed out by @FabrícioMatté in the comments, .map
is way shorter:
$.fn.cloneDumpingEvents = function () {
return this.map(function() {
return $.clone(this);
});
};
Here's your fiddle again: http://jsfiddle.net/dCm59/7/