mirror of
https://github.com/golang/go
synced 2024-11-20 00:04:43 -07:00
html: parse </optgroup> and </option>
Pass tests2.dat, test 35: <!DOCTYPE html><select><optgroup><option></optgroup><option><select><option> | <!DOCTYPE html> | <html> | <head> | <body> | <select> | <optgroup> | <option> | <option> | <option> Also pass tests through test 41: <!DOCTYPE html><!-- XXX - XXX - XXX --> R=nigeltao, rsc CC=golang-dev https://golang.org/cl/5395045
This commit is contained in:
parent
8c6461bcb1
commit
3276afd4d4
@ -1245,9 +1245,17 @@ func inSelectIM(p *parser) bool {
|
||||
case EndTagToken:
|
||||
switch p.tok.Data {
|
||||
case "option":
|
||||
// TODO.
|
||||
if p.top().Data == "option" {
|
||||
p.oe.pop()
|
||||
}
|
||||
case "optgroup":
|
||||
// TODO.
|
||||
i := len(p.oe) - 1
|
||||
if p.oe[i].Data == "option" {
|
||||
i--
|
||||
}
|
||||
if p.oe[i].Data == "optgroup" {
|
||||
p.oe = p.oe[:i]
|
||||
}
|
||||
case "select":
|
||||
endSelect = true
|
||||
default:
|
||||
|
@ -134,7 +134,7 @@ func TestParser(t *testing.T) {
|
||||
}{
|
||||
// TODO(nigeltao): Process all the test cases from all the .dat files.
|
||||
{"tests1.dat", -1},
|
||||
{"tests2.dat", 35},
|
||||
{"tests2.dat", 42},
|
||||
{"tests3.dat", 0},
|
||||
}
|
||||
for _, tf := range testFiles {
|
||||
|
Loading…
Reference in New Issue
Block a user