From 81b6e46522d8c680f6c38d5e95c732b2b47130b9 Mon Sep 17 00:00:00 2001 From: Anthony Ryan Date: Sat, 25 Jul 2015 02:15:02 -0400 Subject: [PATCH] Manipulation: Don't provide the parser with sloppy table markup While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." (cherry-picked from 99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea) Reverts 0ea342a6a6dce793c1b0f14f051c2573f40f4e44 Refs gh-2031 Refs gh-2002 Fixes gh-2493 Closes gh-2499 --- src/manipulation/wrapMap.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js index 505e091f8..e5e5acdab 100644 --- a/src/manipulation/wrapMap.js +++ b/src/manipulation/wrapMap.js @@ -9,21 +9,13 @@ var wrapMap = { // Support: IE8 param: [ 1, "", "" ], + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. thead: [ 1, "", "
" ], - - // Some of the following wrappers are not fully defined, because - // their parent elements (except for "table" element) could be omitted - // since browser parsers are smart enough to auto-insert them - - // Support: Android 2.3 - // Android browser doesn't auto-insert colgroup col: [ 2, "", "
" ], - - // Auto-insert "tbody" element - tr: [ 2, "", "
" ], - - // Auto-insert "tbody" and "tr" elements - td: [ 3, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], // IE8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. -- 2.39.5