]> Cypherpunks repositories - gostls13.git/commitdiff
html: parse <frameset> inside body
authorAndrew Balholm <andybalholm@gmail.com>
Tue, 3 Jan 2012 22:51:15 +0000 (09:51 +1100)
committerNigel Tao <nigeltao@golang.org>
Tue, 3 Jan 2012 22:51:15 +0000 (09:51 +1100)
Pass tests6.dat, test 47:
<param><frameset></frameset>

| <html>
|   <head>
|   <frameset>

Also pass remaining tests in tests6.dat.

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

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

index b2903b302d29ef0076f98e118a5578bd70c0939b..380df83427461ac7023216bb324e7f81959fe2b2 100644 (file)
@@ -749,6 +749,19 @@ func inBodyIM(p *parser) bool {
                                        copyAttributes(body, p.tok)
                                }
                        }
+               case "frameset":
+                       if !p.framesetOK || len(p.oe) < 2 || p.oe[1].Data != "body" {
+                               // Ignore the token.
+                               return true
+                       }
+                       body := p.oe[1]
+                       if body.Parent != nil {
+                               body.Parent.Remove(body)
+                       }
+                       p.oe = p.oe[:1]
+                       p.addElement(p.tok.Data, p.tok.Attr)
+                       p.im = inFramesetIM
+                       return true
                case "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title":
                        return inHeadIM(p)
                case "image":
index 2f6059b2882af17b6600c5f543aaf94766ad34a4..2b6a8b5083b8aeace6ede3f07eab29cb07161197 100644 (file)
@@ -183,7 +183,7 @@ func TestParser(t *testing.T) {
                {"tests3.dat", -1},
                {"tests4.dat", -1},
                {"tests5.dat", -1},
-               {"tests6.dat", 47},
+               {"tests6.dat", -1},
                {"tests10.dat", 30},
        }
        for _, tf := range testFiles {