diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go
index 74578c2b227..6618600a153 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 0eba283b985..f44bf6304ba 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)