Skip to content

Commit 81b6e46

Browse files
anthonyryan1mgol
authored andcommitted
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 99e8ff1) Reverts 0ea342a Refs gh-2031 Refs gh-2002 Fixes gh-2493 Closes gh-2499
1 parent ead83b9 commit 81b6e46

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/manipulation/wrapMap.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,13 @@ var wrapMap = {
99
// Support: IE8
1010
param: [ 1, "<object>", "</object>" ],
1111

12+
// XHTML parsers do not magically insert elements in the
13+
// same way that tag soup parsers do. So we cannot shorten
14+
// this by omitting <tbody> or other required elements.
1215
thead: [ 1, "<table>", "</table>" ],
13-
14-
// Some of the following wrappers are not fully defined, because
15-
// their parent elements (except for "table" element) could be omitted
16-
// since browser parsers are smart enough to auto-insert them
17-
18-
// Support: Android 2.3
19-
// Android browser doesn't auto-insert colgroup
2016
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
21-
22-
// Auto-insert "tbody" element
23-
tr: [ 2, "<table>", "</table>" ],
24-
25-
// Auto-insert "tbody" and "tr" elements
26-
td: [ 3, "<table>", "</table>" ],
17+
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
18+
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
2719

2820
// IE8 can't serialize link, script, style, or any html5 (NoScope) tags,
2921
// unless wrapped in a div with non-breaking characters in front of it.

0 commit comments

Comments
 (0)