1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:24:41 -07:00

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
This commit is contained in:
Andrew Balholm 2011-12-23 11:07:11 +11:00 committed by Nigel Tao
parent f927d9c1bb
commit 4a8ea4ae94
2 changed files with 14 additions and 1 deletions

View File

@ -1572,6 +1572,19 @@ func afterAfterFramesetIM(p *parser) bool {
Type: CommentNode, Type: CommentNode,
Data: p.tok.Data, 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: case StartTagToken:
switch p.tok.Data { switch p.tok.Data {
case "html": case "html":

View File

@ -172,7 +172,7 @@ func TestParser(t *testing.T) {
{"tests3.dat", -1}, {"tests3.dat", -1},
{"tests4.dat", -1}, {"tests4.dat", -1},
{"tests5.dat", -1}, {"tests5.dat", -1},
{"tests6.dat", 45}, {"tests6.dat", 47},
{"tests10.dat", 16}, {"tests10.dat", 16},
} }
for _, tf := range testFiles { for _, tf := range testFiles {