aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js16
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 );
});
}