]> Cypherpunks repositories - gostls13.git/commitdiff
html: auto-close <p> elements when starting <form> element.
authorAndrew Balholm <andybalholm@gmail.com>
Tue, 15 Nov 2011 04:31:22 +0000 (15:31 +1100)
committerNigel Tao <nigeltao@golang.org>
Tue, 15 Nov 2011 04:31:22 +0000 (15:31 +1100)
Pass tests2.dat, test 26:
<!doctypehtml><p><form>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <p>
|     <form>

Also pass tests through test 32:
<!DOCTYPE html><!-- X

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

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

index b92b25c7b06e09e0534ea99e418c950c36f08b5a..5b91204240ae13f39d0e013985d8287c267cfa88 100644 (file)
@@ -619,6 +619,12 @@ func inBodyIM(p *parser) bool {
                        // TODO: detect <select> inside a table.
                        p.im = inSelectIM
                        return true
+               case "form":
+                       if p.form == nil {
+                               p.popUntil(buttonScopeStopTags, "p")
+                               p.addElement(p.tok.Data, p.tok.Attr)
+                               p.form = p.top()
+                       }
                case "li":
                        p.framesetOK = false
                        for i := len(p.oe) - 1; i >= 0; i-- {
index 3c278b3145c9c889021827fa3fd2118e90d256a2..0fd2dc82b301ef14a0bb6c6c326dbef81c46a86f 100644 (file)
@@ -134,7 +134,7 @@ func TestParser(t *testing.T) {
        }{
                // TODO(nigeltao): Process all the test cases from all the .dat files.
                {"tests1.dat", -1},
-               {"tests2.dat", 26},
+               {"tests2.dat", 33},
                {"tests3.dat", 0},
        }
        for _, tf := range testFiles {