]> Cypherpunks repositories - gostls13.git/commitdiff
html: ignore <caption>, <col>, <tbody> etc. when parsing table fragments
authorAndrew Balholm <andybalholm@gmail.com>
Mon, 19 Dec 2011 23:57:06 +0000 (10:57 +1100)
committerNigel Tao <nigeltao@golang.org>
Mon, 19 Dec 2011 23:57:06 +0000 (10:57 +1100)
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

src/pkg/html/parse.go
src/pkg/html/parse_test.go

index a69262115c339aa8fedbdd40a16af8958e34b922..6892d8fefa04ec122aca134085c119e5cd31a663 100644 (file)
@@ -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.
                }
index b938ca71854ca94d80014b208c3087b74208017f..7ca2922cc31b574fe6befb2851038f69a1a517ae 100644 (file)
@@ -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 {