1
0
mirror of https://github.com/golang/go synced 2024-11-25 10:07:56 -07:00

exp/html: don't insert empty text nodes

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6443048
This commit is contained in:
Andrew Balholm 2012-07-26 10:32:24 +10:00 committed by Nigel Tao
parent 24ae7e686d
commit 899be50991
2 changed files with 4 additions and 1 deletions

View File

@ -267,6 +267,9 @@ func (p *parser) fosterParent(n *Node) {
// addText adds text to the preceding node if it is a text node, or else it
// calls addChild with a new text node.
func (p *parser) addText(text string) {
if text == "" {
return
}
// TODO: distinguish whitespace text from others.
t := p.top()
if i := len(t.Child); i > 0 && t.Child[i-1].Type == TextNode {

View File

@ -4,7 +4,7 @@ PASS "<html> \x00 <frameset></frameset>"
PASS "<html>a\x00a<frameset></frameset>"
PASS "<html>\x00\x00<frameset></frameset>"
PASS "<html>\x00\n <frameset></frameset>"
FAIL "<html><select>\x00"
PASS "<html><select>\x00"
PASS "\x00"
PASS "<body>\x00"
FAIL "<plaintext>\x00filler\x00text\x00"