mirror of https://github.com/golang/go.git
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:
parent
24ae7e686d
commit
899be50991
|
|
@ -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
|
// addText adds text to the preceding node if it is a text node, or else it
|
||||||
// calls addChild with a new text node.
|
// calls addChild with a new text node.
|
||||||
func (p *parser) addText(text string) {
|
func (p *parser) addText(text string) {
|
||||||
|
if text == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
// TODO: distinguish whitespace text from others.
|
// TODO: distinguish whitespace text from others.
|
||||||
t := p.top()
|
t := p.top()
|
||||||
if i := len(t.Child); i > 0 && t.Child[i-1].Type == TextNode {
|
if i := len(t.Child); i > 0 && t.Child[i-1].Type == TextNode {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ PASS "<html> \x00 <frameset></frameset>"
|
||||||
PASS "<html>a\x00a<frameset></frameset>"
|
PASS "<html>a\x00a<frameset></frameset>"
|
||||||
PASS "<html>\x00\x00<frameset></frameset>"
|
PASS "<html>\x00\x00<frameset></frameset>"
|
||||||
PASS "<html>\x00\n <frameset></frameset>"
|
PASS "<html>\x00\n <frameset></frameset>"
|
||||||
FAIL "<html><select>\x00"
|
PASS "<html><select>\x00"
|
||||||
PASS "\x00"
|
PASS "\x00"
|
||||||
PASS "<body>\x00"
|
PASS "<body>\x00"
|
||||||
FAIL "<plaintext>\x00filler\x00text\x00"
|
FAIL "<plaintext>\x00filler\x00text\x00"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue