]> Cypherpunks repositories - gostls13.git/commitdiff
html: don't leave "in column group" mode when ignoring a token
authorAndrew Balholm <andybalholm@gmail.com>
Wed, 14 Dec 2011 23:45:19 +0000 (10:45 +1100)
committerNigel Tao <nigeltao@golang.org>
Wed, 14 Dec 2011 23:45:19 +0000 (10:45 +1100)
Pass tests6.dat, test 26:
foo<col>

| <col>

Also pass tests through test 35:
<table><tr><div><td>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5482074

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

index 6618600a15385a72a8a3f66342a4011503505663..4cb246969e54ca1c3b860b167d718bfd0376c4be 100644 (file)
@@ -1166,8 +1166,8 @@ func inColumnGroupIM(p *parser) bool {
                case "colgroup":
                        if p.oe.top().Data != "html" {
                                p.oe.pop()
+                               p.im = inTableIM
                        }
-                       p.im = inTableIM
                        return true
                case "col":
                        // Ignore the token.
@@ -1176,9 +1176,10 @@ func inColumnGroupIM(p *parser) bool {
        }
        if p.oe.top().Data != "html" {
                p.oe.pop()
+               p.im = inTableIM
+               return false
        }
-       p.im = inTableIM
-       return false
+       return true
 }
 
 // Section 12.2.5.4.13.
index f44bf6304bada7e67b64b3f3d592cad02353eb55..e887631c63d70d5ff00749f8b8cb82d3f21c7a4e 100644 (file)
@@ -172,7 +172,7 @@ func TestParser(t *testing.T) {
                {"tests3.dat", -1},
                {"tests4.dat", -1},
                {"tests5.dat", -1},
-               {"tests6.dat", 26},
+               {"tests6.dat", 36},
        }
        for _, tf := range testFiles {
                f, err := os.Open("testdata/webkit/" + tf.filename)