mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fixes #13200 - innerHTML in buildFragment need end tags
This commit is contained in:
parent
e5f37953ba
commit
bf4fce7040
@ -29,18 +29,18 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
|
|||||||
rscriptTypeMasked = /^true\/(.*)/,
|
rscriptTypeMasked = /^true\/(.*)/,
|
||||||
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
|
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
|
||||||
wrapMap = {
|
wrapMap = {
|
||||||
option: [ 1, "<select multiple='multiple'>" ],
|
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||||
legend: [ 1, "<fieldset>" ],
|
legend: [ 1, "<fieldset>", "</fieldset>" ],
|
||||||
area: [ 1, "<map>" ],
|
area: [ 1, "<map>", "</map>" ],
|
||||||
param: [ 1, "<object>" ],
|
param: [ 1, "<object>", "</object>" ],
|
||||||
thead: [ 1, "<table>" ],
|
thead: [ 1, "<table>", "</table>" ],
|
||||||
tr: [ 2, "<table><tbody>" ],
|
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
||||||
col: [ 2, "<table><tbody></tbody><colgroup>", "</table>" ],
|
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
||||||
td: [ 3, "<table><tbody><tr>" ],
|
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
||||||
|
|
||||||
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
||||||
// unless wrapped in a div with non-breaking characters in front of it.
|
// unless wrapped in a div with non-breaking characters in front of it.
|
||||||
_default: jQuery.support.htmlSerialize ? [ 0, "" ] : [ 1, "X<div>" ]
|
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
|
||||||
},
|
},
|
||||||
safeFragment = createSafeFragment( document ),
|
safeFragment = createSafeFragment( document ),
|
||||||
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
|
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
|
||||||
@ -647,7 +647,8 @@ jQuery.extend({
|
|||||||
// Deserialize a standard representation
|
// Deserialize a standard representation
|
||||||
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
|
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
|
||||||
wrap = wrapMap[ tag ] || wrapMap._default;
|
wrap = wrapMap[ tag ] || wrapMap._default;
|
||||||
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + ( wrap[2] || "" );
|
|
||||||
|
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
|
||||||
|
|
||||||
// Descend through wrappers to the right content
|
// Descend through wrappers to the right content
|
||||||
j = wrap[0];
|
j = wrap[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user