Commit 3276afd4 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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
parent 8c6461bc
...@@ -1245,9 +1245,17 @@ func inSelectIM(p *parser) bool { ...@@ -1245,9 +1245,17 @@ func inSelectIM(p *parser) bool {
case EndTagToken: case EndTagToken:
switch p.tok.Data { switch p.tok.Data {
case "option": case "option":
// TODO. if p.top().Data == "option" {
p.oe.pop()
}
case "optgroup": 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": case "select":
endSelect = true endSelect = true
default: default:
......
...@@ -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", 35}, {"tests2.dat", 42},
{"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