aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2011-12-14 21:40:31 +1100
committerNigel Tao <nigeltao@golang.org>2011-12-14 21:40:31 +1100
commite25a83d03e97edf0d8474ad41ed2edd0a63b19fc (patch)
tree69eb93af74d0a27d168c8d8ea52a88881a80ea7f
parent3c638f2892471b55ded3982d2639e5c62f00d506 (diff)
downloadgo-e25a83d03e97edf0d8474ad41ed2edd0a63b19fc.tar.gz
go-e25a83d03e97edf0d8474ad41ed2edd0a63b19fc.zip
html: close <button> element before opening a new one
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
-rw-r--r--src/pkg/html/parse.go5
-rw-r--r--src/pkg/html/parse_test.go2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go
index 74578c2b22..6618600a15 100644
--- a/src/pkg/html/parse.go
+++ b/src/pkg/html/parse.go
@@ -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()
diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go
index 0eba283b98..f44bf6304b 100644
--- a/src/pkg/html/parse_test.go
+++ b/src/pkg/html/parse_test.go
@@ -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)