diff options
author | jeresig <jeresig@gmail.com> | 2010-01-06 15:08:07 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-01-06 15:08:07 -0500 |
commit | 600d3145386a9dca8143918cc3e339168f886a63 (patch) | |
tree | 3f92d7cf15bf443e5432a013007bb25424375cf2 /src/manipulation.js | |
parent | 84dd82eb1a295e8671a98ebf5a854dbac63caf78 (diff) | |
download | jquery-600d3145386a9dca8143918cc3e339168f886a63.tar.gz jquery-600d3145386a9dca8143918cc3e339168f886a63.zip |
A first pass at making sure that all the setter function arguments receive the index of the element and a relevant value to work with. Fixes #5763.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 2af2d7e7d..730dfca5e 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 ); }); } |