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.
This commit is contained in:
parent
84dd82eb1a
commit
600d314538
3 changed files with 72 additions and 60 deletions
|
@ -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 );
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue