From bf4fce70408b67d1bf628932ec31dafa14eb007c Mon Sep 17 00:00:00 2001 From: Oleg Date: Sun, 13 Jan 2013 21:45:52 +0400 Subject: [PATCH] Fixes #13200 - innerHTML in buildFragment need end tags --- src/manipulation.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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];