1
0
mirror of https://github.com/golang/go synced 2024-10-03 09:21:21 -06:00

exp/html: ignore null bytes in text

pass one additional test

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6048051
This commit is contained in:
Andrew Balholm 2012-04-20 14:25:42 +10:00 committed by Nigel Tao
parent 7d63ff09a5
commit 6791057296
2 changed files with 7 additions and 7 deletions

View File

@ -616,25 +616,25 @@ func copyAttributes(dst *Node, src Token) {
func inBodyIM(p *parser) bool {
switch p.tok.Type {
case TextToken:
d := p.tok.Data
switch n := p.oe.top(); n.Data {
case "pre", "listing", "textarea":
if len(n.Child) == 0 {
// Ignore a newline at the start of a <pre> block.
d := p.tok.Data
if d != "" && d[0] == '\r' {
d = d[1:]
}
if d != "" && d[0] == '\n' {
d = d[1:]
}
}
}
d = strings.Replace(d, "\x00", "", -1)
if d == "" {
return true
}
p.tok.Data = d
}
}
p.reconstructActiveFormattingElements()
p.addText(p.tok.Data)
p.addText(d)
p.framesetOK = false
case StartTagToken:
switch p.tok.Data {

View File

@ -1 +1 @@
FAIL "<body><table>\x00filler\x00text\x00"
PASS "<body><table>\x00filler\x00text\x00"