]> Cypherpunks repositories - gostls13.git/commitdiff
html: close <button> element before opening a new one
authorAndrew Balholm <andybalholm@gmail.com>
Wed, 14 Dec 2011 10:40:31 +0000 (21:40 +1100)
committerNigel Tao <nigeltao@golang.org>
Wed, 14 Dec 2011 10:40:31 +0000 (21:40 +1100)
Pass tests6.dat, test 13:
<button><button>

| <html>
|   <head>
|   <body>
|     <button>
|     <button>

Also pass tests through test 25:
<table><colgroup>foo

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

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

index 74578c2b227e1429499816a0500dfff54ce3bd92..6618600a15385a72a8a3f66342a4011503505663 100644 (file)
@@ -734,6 +734,11 @@ func inBodyIM(p *parser) bool {
                case "plaintext":
                        p.popUntil(buttonScopeStopTags, "p")
                        p.addElement(p.tok.Data, p.tok.Attr)
+               case "button":
+                       p.popUntil(defaultScopeStopTags, "button")
+                       p.reconstructActiveFormattingElements()
+                       p.addElement(p.tok.Data, p.tok.Attr)
+                       p.framesetOK = false
                case "optgroup", "option":
                        if p.top().Data == "option" {
                                p.oe.pop()
index 0eba283b985a1e26d6d17508839d9ad954c27eb0..f44bf6304bada7e67b64b3f3d592cad02353eb55 100644 (file)
@@ -172,7 +172,7 @@ func TestParser(t *testing.T) {
                {"tests3.dat", -1},
                {"tests4.dat", -1},
                {"tests5.dat", -1},
-               {"tests6.dat", 13},
+               {"tests6.dat", 26},
        }
        for _, tf := range testFiles {
                f, err := os.Open("testdata/webkit/" + tf.filename)