X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=17cfa842dc6d9f48ac389cdd5701233e728aa214;hb=616aceef84dca3960f6b78680f41bdcf85fa7838;hp=a8cb484bbd8e667e338d47fc37c5a45dd36931c3;hpb=3f7fc25494988ee5be66c0af0d552b24f0ca1b79;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index a8cb484..17cfa84 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -32,6 +32,12 @@ if ( !jQuery.support.htmlSerialize ) { jQuery.fn.extend({ text: function( text ) { + if(jQuery.isFunction(text)) { + return this.each(function() { + return jQuery(this).text( text.call(this) ); + }); + } + if ( typeof text !== "object" && text !== undefined ) { return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); } @@ -48,7 +54,7 @@ jQuery.fn.extend({ if ( this[0] ) { // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(); + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); @@ -87,7 +93,7 @@ jQuery.fn.extend({ } }).end(); }, - + append: function() { return this.domManip(arguments, true, function(elem){ if ( this.nodeType === 1 ) { @@ -277,13 +283,7 @@ function cloneCopyEvent(orig, ret) { return; } - var events = jQuery.data( orig[i], "events" ); - - for ( var type in events ) { - for ( var handler in events[ type ] ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } + jQuery.data( this, jQuery.data( orig[i++] ) ); }); } @@ -463,7 +463,7 @@ jQuery.extend({ function cleanData( elems ) { for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) { - if ( (id = elem[expando]) ) { + if ( !jQuery.noData[elem.nodeName.toLowerCase()] && (id = elem[expando]) ) { delete jQuery.cache[ id ]; } }