X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmanipulation.js;h=d8f51a1711384708075343aaea3e2b336b7dd515;hb=6f7adb95c1f87869e071541c7e5c92a6189db713;hp=2dccc759255574810ac6881e4d4c4b25ba6ea079;hpb=f95147f465932cb91e1a6aace50c556820ca4074;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 2dccc75..d8f51a1 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -197,7 +197,7 @@ jQuery.fn.extend({ // as properties will not be copied (such as the // the name attribute on an input). var html = this.outerHTML, ownerDocument = this.ownerDocument; - if ( !html || jQuery.nodeName( this, "form" ) ) { + if ( !html ) { var div = ownerDocument.createElement("div"); div.appendChild( this.cloneNode(true) ); html = div.innerHTML; @@ -268,16 +268,17 @@ jQuery.fn.extend({ if ( this[0] && this[0].parentNode ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements - if ( !jQuery.isFunction( value ) ) { - value = jQuery( value ).detach(); - - } else { + if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } + if ( typeof value !== "string" ) { + value = jQuery(value).detach(); + } + return this.each(function() { var next = this.nextSibling, parent = this.parentNode;