]> Cypherpunks repositories - gostls13.git/commitdiff
html: ignore <col> tag outside tables
authorAndrew Balholm <andybalholm@gmail.com>
Fri, 11 Nov 2011 10:44:01 +0000 (21:44 +1100)
committerNigel Tao <nigeltao@golang.org>
Fri, 11 Nov 2011 10:44:01 +0000 (21:44 +1100)
Pass tests1.dat, test 109:
<table><col><tbody><col><tr><col><td><col></table><col>

| <html>
|   <head>
|   <body>
|     <table>
|       <colgroup>
|         <col>
|       <tbody>
|       <colgroup>
|         <col>
|       <tbody>
|         <tr>
|       <colgroup>
|         <col>
|       <tbody>
|         <tr>
|           <td>
|       <colgroup>
|         <col>

Also pass test 110:
<table><colgroup><tbody><colgroup><tr><colgroup><td><colgroup></table><colgroup>

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

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

index 6aef7e12edf608693bff4288fc5db28ef30abf9e..e609cce12985d5f47898de31bb772f93fb1e1971 100644 (file)
@@ -667,6 +667,8 @@ func inBodyIM(p *parser) (insertionMode, bool) {
                case "image":
                        p.tok.Data = "img"
                        return inBodyIM, false
+               case "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr":
+                       // Ignore the token.
                default:
                        // TODO.
                        p.addElement(p.tok.Data, p.tok.Attr)
index c69bfa42adf869d7fd9d57e243b7ae865462fed3..d783ee32c925eac80fb02967b1afe2a3f1111ebc 100644 (file)
@@ -133,7 +133,7 @@ func TestParser(t *testing.T) {
                n int
        }{
                // TODO(nigeltao): Process all the test cases from all the .dat files.
-               {"tests1.dat", 109},
+               {"tests1.dat", 111},
                {"tests2.dat", 0},
                {"tests3.dat", 0},
        }