]> Cypherpunks repositories - gostls13.git/commitdiff
html: Don't ignore whitespace in "after after frameset" mode.
authorAndrew Balholm <andybalholm@gmail.com>
Fri, 23 Dec 2011 00:07:11 +0000 (11:07 +1100)
committerNigel Tao <nigeltao@golang.org>
Fri, 23 Dec 2011 00:07:11 +0000 (11:07 +1100)
Pass tests6.dat, test 46:
<html><frameset></frameset></html>

| <html>
|   <head>
|   <frameset>
|   " "

R=nigeltao
CC=golang-dev
https://golang.org/cl/5505065

src/pkg/html/parse.go
src/pkg/html/parse_test.go

index 67356e450c490f1079736669bd6a3869638f448a..6962e643932cae1a27a559697393ca33400de8fb 100644 (file)
@@ -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":
index 1c2df5a7ee37899e5b245579f63504b730c05b15..015b5838f0b50b3a0e8f33e39c545dc68988a60c 100644 (file)
@@ -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 {