X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=730dfca5e1296d299a05676f74f423845cd09202;hb=600d3145386a9dca8143918cc3e339168f886a63;hp=2af2d7e7dc80598794e2d7d2b72b3a82d9b914bb;hpb=84dd82eb1a295e8671a98ebf5a854dbac63caf78;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 2af2d7e..730dfca 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -33,8 +33,9 @@ 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) ); + return this.each(function(i) { + var self = jQuery(this); + return self.text( text.call(this, i, self.text()) ); }); } @@ -47,8 +48,8 @@ jQuery.fn.extend({ wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { - return this.each(function() { - jQuery(this).wrapAll( html.apply(this, arguments) ); + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); }); } @@ -228,9 +229,10 @@ jQuery.fn.extend({ var results, first, value = args[0], scripts = []; if ( jQuery.isFunction(value) ) { - return this.each(function() { - args[0] = value.call(this); - return jQuery(this).domManip( args, table, callback ); + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call(this, i, table ? self.html() : undefined); + return self.domManip( args, table, callback ); }); }