1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:07:58 -07:00

html: parse <optgroup> tags

Pass tests2.dat, test 34:
<!DOCTYPE html><select><option><optgroup>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <select>
|       <option>
|       <optgroup>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5393045
This commit is contained in:
Andrew Balholm 2011-11-16 19:25:55 +11:00 committed by Nigel Tao
parent 28546ed56a
commit 3307597069
2 changed files with 8 additions and 2 deletions

View File

@ -1226,7 +1226,13 @@ func inSelectIM(p *parser) bool {
} }
p.addElement(p.tok.Data, p.tok.Attr) p.addElement(p.tok.Data, p.tok.Attr)
case "optgroup": case "optgroup":
// TODO. if p.top().Data == "option" {
p.oe.pop()
}
if p.top().Data == "optgroup" {
p.oe.pop()
}
p.addElement(p.tok.Data, p.tok.Attr)
case "select": case "select":
endSelect = true endSelect = true
case "input", "keygen", "textarea": case "input", "keygen", "textarea":

View File

@ -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", 34}, {"tests2.dat", 35},
{"tests3.dat", 0}, {"tests3.dat", 0},
} }
for _, tf := range testFiles { for _, tf := range testFiles {