]> Cypherpunks repositories - gostls13.git/commitdiff
exp/html: adjust inRowIM to match spec
authorAndrew Balholm <andybalholm@gmail.com>
Sun, 20 May 2012 04:26:20 +0000 (14:26 +1000)
committerNigel Tao <nigeltao@golang.org>
Sun, 20 May 2012 04:26:20 +0000 (14:26 +1000)
Delete cases that just fall down to "anything else" action.

Handle </tbody>, </tfoot>, and </thead>.

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

src/pkg/exp/html/parse.go

index ba1ff0b447387ebe66d7fe60ba1e513262b48350..05c208edcc839de3eb81edf9d657503c8940e55b 100644 (file)
@@ -1401,10 +1401,6 @@ func inTableBodyIM(p *parser) bool {
 // Section 12.2.5.4.14.
 func inRowIM(p *parser) bool {
        switch p.tok.Type {
-       case ErrorToken:
-               // TODO.
-       case TextToken:
-               // TODO.
        case StartTagToken:
                switch p.tok.Data {
                case "td", "th":
@@ -1420,8 +1416,6 @@ func inRowIM(p *parser) bool {
                        }
                        // Ignore the token.
                        return true
-               default:
-                       // TODO.
                }
        case EndTagToken:
                switch p.tok.Data {
@@ -1440,20 +1434,18 @@ func inRowIM(p *parser) bool {
                        // Ignore the token.
                        return true
                case "tbody", "tfoot", "thead":
-                       // TODO.
+                       if p.elementInScope(tableScope, p.tok.Data) {
+                               p.parseImpliedToken(EndTagToken, "tr", nil)
+                               return false
+                       }
+                       // Ignore the token.
+                       return true
                case "body", "caption", "col", "colgroup", "html", "td", "th":
                        // Ignore the token.
                        return true
-               default:
-                       // TODO.
                }
-       case CommentToken:
-               p.addChild(&Node{
-                       Type: CommentNode,
-                       Data: p.tok.Data,
-               })
-               return true
        }
+
        return inTableIM(p)
 }