diff options
author | Anton M <haskell_noob-github@yahoo.de> | 2010-11-21 01:58:46 +0100 |
---|---|---|
committer | Anton M <haskell_noob-github@yahoo.de> | 2010-11-21 01:58:46 +0100 |
commit | ab2a70e6cfba19ec9140c3e393e8cdb60c537bdb (patch) | |
tree | 7d5254ff5c6db3154ac24a1a812817a9036c0eb5 /src/manipulation.js | |
parent | 0838bdf52cf9f27ebc2bbee74fd7170e2d854c11 (diff) | |
download | jquery-ab2a70e6cfba19ec9140c3e393e8cdb60c537bdb.tar.gz jquery-ab2a70e6cfba19ec9140c3e393e8cdb60c537bdb.zip |
Make sure IE clones body elements correctly. Fixes 4386.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index d8fa020c8..e09dd7eb4 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*<body/i, + rbodyend = /<\/body>\s*$/i, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], @@ -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, "<div>" ).replace( rbodyend, "</div>" ); } return jQuery.clean([html.replace(rinlinejQuery, "") |