aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/html
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2011-12-12 13:18:01 +1100
committerNigel Tao <nigeltao@golang.org>2011-12-12 13:18:01 +1100
commit0c5443a0a61182276f755c1c728d4990cf0983e9 (patch)
treed92185286565e3060c711721438be1d4eea32d72 /src/pkg/html
parent49d82b4ca1a902f5667e845e82440c83287ee633 (diff)
downloadgo-0c5443a0a61182276f755c1c728d4990cf0983e9.tar.xz
html: don't ignore whitespace in or after framesets
Pass tests6.dat, test 7: <frameset></frameset> foo | <html> | <head> | <frameset> | " " Also pass tests through test 12: <form><form> R=nigeltao CC=golang-dev https://golang.org/cl/5480061
Diffstat (limited to 'src/pkg/html')
-rw-r--r--src/pkg/html/parse.go24
-rw-r--r--src/pkg/html/parse_test.go2
2 files changed, 25 insertions, 1 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go
index dd2d8165bd..24cb323a59 100644
--- a/src/pkg/html/parse.go
+++ b/src/pkg/html/parse.go
@@ -1432,6 +1432,18 @@ func inFramesetIM(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.addText(s)
+ }
case StartTagToken:
switch p.tok.Data {
case "html":
@@ -1470,6 +1482,18 @@ func afterFramesetIM(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.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 5062a6edcb..8f8787886c 100644
--- a/src/pkg/html/parse_test.go
+++ b/src/pkg/html/parse_test.go
@@ -167,7 +167,7 @@ func TestParser(t *testing.T) {
{"tests3.dat", -1},
{"tests4.dat", -1},
{"tests5.dat", -1},
- {"tests6.dat", 7},
+ {"tests6.dat", 13},
}
for _, tf := range testFiles {
f, err := os.Open("testdata/webkit/" + tf.filename)