1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:34:40 -07:00

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
This commit is contained in:
Andrew Balholm 2011-12-14 21:40:31 +11:00 committed by Nigel Tao
parent 3c638f2892
commit e25a83d03e
2 changed files with 6 additions and 1 deletions

View 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()

View 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)