diff options
author | Andrew Balholm <andybalholm@gmail.com> | 2011-12-23 11:07:11 +1100 |
---|---|---|
committer | Nigel Tao <nigeltao@golang.org> | 2011-12-23 11:07:11 +1100 |
commit | 4a8ea4ae94c5db39f38cd1c8b7d0c8df6dc82f7b (patch) | |
tree | 99a024cc95d3c8651665960ac5eef1415e74c4d4 | |
parent | f927d9c1bb71e759ce035d1d6fd497a7ccfbd308 (diff) | |
download | go-4a8ea4ae94c5db39f38cd1c8b7d0c8df6dc82f7b.tar.gz go-4a8ea4ae94c5db39f38cd1c8b7d0c8df6dc82f7b.zip |
html: Don't ignore whitespace in "after after frameset" mode.
Pass tests6.dat, test 46:
<html><frameset></frameset></html>
| <html>
| <head>
| <frameset>
| " "
R=nigeltao
CC=golang-dev
https://golang.org/cl/5505065
-rw-r--r-- | src/pkg/html/parse.go | 13 | ||||
-rw-r--r-- | src/pkg/html/parse_test.go | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index 67356e450c..6962e64393 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -1572,6 +1572,19 @@ func afterAfterFramesetIM(p *parser) bool { Type: CommentNode, Data: p.tok.Data, }) + case TextToken: + // Ignore all text but whitespace. + s := strings.Map(func(c rune) rune { + switch c { + case ' ', '\t', '\n', '\f', '\r': + return c + } + return -1 + }, p.tok.Data) + if s != "" { + p.reconstructActiveFormattingElements() + p.addText(s) + } case StartTagToken: switch p.tok.Data { case "html": diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index 1c2df5a7ee..015b5838f0 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -172,7 +172,7 @@ func TestParser(t *testing.T) { {"tests3.dat", -1}, {"tests4.dat", -1}, {"tests5.dat", -1}, - {"tests6.dat", 45}, + {"tests6.dat", 47}, {"tests10.dat", 16}, } for _, tf := range testFiles { |