diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index 530942aa8f..823f7aad29 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -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) diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index b0ddd92476..5022a4f779 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -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 {