From: Andrew Balholm Date: Mon, 19 Dec 2011 23:57:06 +0000 (+1100) Subject: html: ignore , , etc. when parsing table fragments X-Git-Tag: weekly.2011-12-22~113 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a0bd46e70fa09e8fe4749399440a2dc52e80f84a;p=gostls13.git html: ignore , , etc. when parsing table fragments Pass tests6.dat, test 36: | Pass tests through test 44: R=nigeltao CC=golang-dev https://golang.org/cl/5494055 --- diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index a69262115c..6892d8fefa 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -1206,6 +1206,13 @@ func inTableBodyIM(p *parser) bool { add = true data = "tr" 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: // TODO. } diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index b938ca7185..7ca2922cc3 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -172,7 +172,7 @@ func TestParser(t *testing.T) { {"tests3.dat", -1}, {"tests4.dat", -1}, {"tests5.dat", -1}, - {"tests6.dat", 36}, + {"tests6.dat", 45}, {"tests10.dat", 13}, } for _, tf := range testFiles {