X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=8d951b648547eb476fa395045b379909fcf08e75;hb=bc05cb9d80b63d8a324a3773a39ac1baa181c4d2;hp=5b53da86199c678144a01683c8c8862ebe0aa5fe;hpb=c8be9461eed2cd01fb45ae504f92f80fe72bddde;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 5b53da8..8d951b6 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -10,6 +10,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, // checked="checked" or checked (html5) rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, raction = /\=([^="'>\s]+\/)>/g, + rbodystart = /^\s*\s*$/i, wrapMap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], @@ -198,11 +200,12 @@ jQuery.fn.extend({ // the name attribute on an input). var html = this.outerHTML, ownerDocument = this.ownerDocument; - if ( !html ) { var div = ownerDocument.createElement("div"); div.appendChild( this.cloneNode(true) ); html = div.innerHTML; + } else if ( rbodystart.test(html) && rbodyend.test(html) ) { + html = html.replace( rbodystart, "
" ).replace( rbodyend, "
" ); } return jQuery.clean([html.replace(rinlinejQuery, "") @@ -349,7 +352,7 @@ jQuery.fn.extend({ root(this[i], first) : this[i], i > 0 || results.cacheable || this.length > 1 ? - fragment.cloneNode(true) : + jQuery(fragment).clone(true)[0] : fragment ); }