From 8fa9e9d6d0307a5af8d7478d6e030af5afabba9e Mon Sep 17 00:00:00 2001 From: jeresig Date: Thu, 7 Jan 2010 13:33:30 -0500 Subject: [PATCH] Make sure that .html(Function) gets the correct previous value. --- src/manipulation.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/manipulation.js b/src/manipulation.js index 081bb5481..9ed22baaf 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -196,6 +196,14 @@ jQuery.fn.extend({ this.empty().append( value ); } + } else if ( jQuery.isFunction( value ) ) { + this.each(function(i){ + var self = jQuery(this), old = self.html(); + self.empty().append(function(){ + return value.call( this, i, old ); + }); + }); + } else { this.empty().append( value ); } -- 2.39.5