Commit a0bd46e7 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

html: ignore <caption>, <col>, <tbody> etc. when parsing table fragments

Pass tests6.dat, test 36:
<caption><col><colgroup><tbody><tfoot><thead><tr>

| <tr>

Pass tests through test 44:
<body></body></html>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5494055
parent 315b361f
...@@ -1206,6 +1206,13 @@ func inTableBodyIM(p *parser) bool { ...@@ -1206,6 +1206,13 @@ func inTableBodyIM(p *parser) bool {
add = true add = true
data = "tr" data = "tr"
consumed = false consumed = false
case "caption", "col", "colgroup", "tbody", "tfoot", "thead":
if !p.popUntil(tableScopeStopTags, "tbody", "thead", "tfoot") {
// Ignore the token.
return true
}
p.im = inTableIM
return false
default: default:
// TODO. // TODO.
} }
......
...@@ -172,7 +172,7 @@ func TestParser(t *testing.T) { ...@@ -172,7 +172,7 @@ func TestParser(t *testing.T) {
{"tests3.dat", -1}, {"tests3.dat", -1},
{"tests4.dat", -1}, {"tests4.dat", -1},
{"tests5.dat", -1}, {"tests5.dat", -1},
{"tests6.dat", 36}, {"tests6.dat", 45},
{"tests10.dat", 13}, {"tests10.dat", 13},
} }
for _, tf := range testFiles { for _, tf := range testFiles {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment