From: Andrew Balholm Date: Wed, 16 Nov 2011 08:25:55 +0000 (+1100) Subject: html: parse tags X-Git-Tag: weekly.2011-11-18~38 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3307597069f533a1f34beadb735af804d47ef6de;p=gostls13.git html: parse tags Pass tests2.dat, test 34: | R=nigeltao CC=golang-dev https://golang.org/cl/5393045 --- diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index 2c15d2d31e..ca3907cc02 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -1226,7 +1226,13 @@ func inSelectIM(p *parser) bool { } p.addElement(p.tok.Data, p.tok.Attr) case "optgroup": - // TODO. + if p.top().Data == "option" { + p.oe.pop() + } + if p.top().Data == "optgroup" { + p.oe.pop() + } + p.addElement(p.tok.Data, p.tok.Attr) case "select": endSelect = true case "input", "keygen", "textarea": diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index 3837f34b19..01d1facc1a 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -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", 34}, + {"tests2.dat", 35}, {"tests3.dat", 0}, } for _, tf := range testFiles {