From: Oleg Date: Sun, 13 Jan 2013 17:45:52 +0000 (+0400) Subject: Fixes #13200 - innerHTML in buildFragment need end tags X-Git-Tag: 1.9.0~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bf4fce70408b67d1bf628932ec31dafa14eb007c;p=jquery.git Fixes #13200 - innerHTML in buildFragment need end tags --- diff --git a/src/manipulation.js b/src/manipulation.js index 984f80307..5b462645c 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -29,18 +29,18 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*\s*$/g, wrapMap = { - option: [ 1, "", "" ], + legend: [ 1, "
", "
" ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + col: [ 2, "", "
" ], + td: [ 3, "", "
" ], // 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. - _default: jQuery.support.htmlSerialize ? [ 0, "" ] : [ 1, "X
" ] + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); @@ -647,7 +647,8 @@ jQuery.extend({ // Deserialize a standard representation tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + ( wrap[2] || "" ); + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; // Descend through wrappers to the right content j = wrap[0];