Commit 0c5443a0 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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
parent 49d82b4c
......@@ -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":
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment