1
0
mirror of https://github.com/golang/go synced 2024-11-24 23:07:56 -07:00

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
This commit is contained in:
Andrew Balholm 2011-10-27 09:45:53 +11:00 committed by Nigel Tao
parent 2cf5359830
commit bd07e4f259
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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 {