X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=708de893c59ddebc4689b5875db5f832bd2904a1;hb=d74389997106b02cf513f573a0d7197ecc511514;hp=543bbcd5e6535c1f27993542e18ea7141b48b489;hpb=f9417b9da980f4fa79d03ba691d9f3442c5ab2f2;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 543bbcd..708de89 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -4,7 +4,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, rtagName = /<([\w:]+)/, rtbody = / self-closes a tag + .replace(/=([^="'>\s]+\/)>/g, '="$1">') .replace(rleadingWhitespace, "")], ownerDocument)[0]; } else { return this.cloneNode(true); @@ -266,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;