Commit b91d8225 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

html: auto-close <p> elements when starting <form> element.

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
parent a619da9f
...@@ -619,6 +619,12 @@ func inBodyIM(p *parser) bool { ...@@ -619,6 +619,12 @@ func inBodyIM(p *parser) bool {
// TODO: detect <select> inside a table. // TODO: detect <select> inside a table.
p.im = inSelectIM p.im = inSelectIM
return true 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": case "li":
p.framesetOK = false p.framesetOK = false
for i := len(p.oe) - 1; i >= 0; i-- { for i := len(p.oe) - 1; i >= 0; i-- {
......
...@@ -134,7 +134,7 @@ func TestParser(t *testing.T) { ...@@ -134,7 +134,7 @@ func TestParser(t *testing.T) {
}{ }{
// TODO(nigeltao): Process all the test cases from all the .dat files. // TODO(nigeltao): Process all the test cases from all the .dat files.
{"tests1.dat", -1}, {"tests1.dat", -1},
{"tests2.dat", 26}, {"tests2.dat", 33},
{"tests3.dat", 0}, {"tests3.dat", 0},
} }
for _, tf := range testFiles { for _, tf := range testFiles {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment