Skip to content

Commit 99e8ff1

Browse files
anthonyryan1mgol
authored andcommittedSep 14, 2015
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." Reverts 0ea342a Refs gh-2031 Refs gh-2002 Fixes gh-2493 Closes gh-2499
1 parent b5f7c9e commit 99e8ff1

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed
 

‎src/manipulation/wrapMap.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@ var wrapMap = {
66
// Support: IE9
77
option: [ 1, "<select multiple='multiple'>", "</select>" ],
88

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

2417
_default: [ 0, "", "" ]
2518
};

0 commit comments

Comments
 (0)