} 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 );
- });
+ var self = jQuery(this);
+ self.html( value.call(this, i, self.html()) );
});
} else {
test("html(Function)", function() {
testHtml(functionReturningObj);
+
+ expect(33);
+
+ QUnit.reset();
+
+ jQuery("#main").html(function(){
+ return jQuery(this).text();
+ });
+
+ ok( !/</.test( jQuery("#main").html() ), "Replace html with text." );
+ ok( jQuery("#main").html().length > 0, "Make sure text exists." );
});
test("html(Function) with incoming value", function() {