From: jeresig Date: Thu, 7 Jan 2010 18:33:30 +0000 (-0500) Subject: Make sure that .html(Function) gets the correct previous value. X-Git-Tag: 1.4rc1~16^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8fa9e9d6d0307a5af8d7478d6e030af5afabba9e;p=jquery.git Make sure that .html(Function) gets the correct previous value. --- 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 ); }