Commit 67910572 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

exp/html: ignore null bytes in text

pass one additional test

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6048051
parent 7d63ff09
......@@ -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:]
}
if d == "" {
return true
}
p.tok.Data = d
}
}
d = strings.Replace(d, "\x00", "", -1)
if d == "" {
return true
}
p.reconstructActiveFormattingElements()
p.addText(p.tok.Data)
p.addText(d)
p.framesetOK = false
case StartTagToken:
switch p.tok.Data {
......
FAIL "<body><table>\x00filler\x00text\x00"
PASS "<body><table>\x00filler\x00text\x00"
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