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