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

html: close <option> element when opening <optgroup>

Pass tests1.dat, test 34:
<!DOCTYPE html>A<option>B<optgroup>C<select>D</option>E

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     "A"
|     <option>
|       "B"
|     <optgroup>
|       "C"
|       <select>
|         "DE"

Also passes tests 35-48. Test 48 is:
</ COM--MENT >

R=nigeltao
CC=golang-dev
https://golang.org/cl/5311063
parent 2cf53598
......@@ -594,6 +594,12 @@ func inBodyIM(p *parser) (insertionMode, bool) {
}
p.popUntil(buttonScopeStopTags, "p")
p.addElement("li", p.tok.Attr)
case "optgroup", "option":
if p.top().Data == "option" {
p.oe.pop()
}
p.reconstructActiveFormattingElements()
p.addElement(p.tok.Data, p.tok.Attr)
default:
// TODO.
p.addElement(p.tok.Data, p.tok.Attr)
......
......@@ -132,7 +132,7 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader)
go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset.
for i := 0; i < 34; i++ {
for i := 0; i < 49; i++ {
// Parse the #data section.
b, err := ioutil.ReadAll(<-rc)
if err != nil {
......
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