diff options
| author | Andrew Balholm <andybalholm@gmail.com> | 2011-10-27 09:45:53 +1100 |
|---|---|---|
| committer | Nigel Tao <nigeltao@golang.org> | 2011-10-27 09:45:53 +1100 |
| commit | bd07e4f25906f4443811e3b6bdb4ff2918beed0c (patch) | |
| tree | ec1e5b8bb12bf4f42f94433b8ca6d11e623a22df /src/pkg/html | |
| parent | 2cf5359830b3a79fcc67b054d5f5f5926a862ad1 (diff) | |
| download | go-bd07e4f25906f4443811e3b6bdb4ff2918beed0c.tar.xz | |
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
Diffstat (limited to 'src/pkg/html')
| -rw-r--r-- | src/pkg/html/parse.go | 6 | ||||
| -rw-r--r-- | src/pkg/html/parse_test.go | 2 |
2 files changed, 7 insertions, 1 deletions
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 { |
