1
0
mirror of https://github.com/golang/go synced 2024-11-18 17:54:57 -07:00

exp/html: allow frameset if body contains whitespace

If the body of an HTML document contains text, the <frameset> tag is
ignored. But not if the text is only whitespace.

Pass 4 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6442043
This commit is contained in:
Andrew Balholm 2012-07-25 12:09:58 +10:00 committed by Nigel Tao
parent 3e980e24c1
commit 4d22519678
3 changed files with 8 additions and 5 deletions

View File

@ -725,7 +725,10 @@ func inBodyIM(p *parser) bool {
}
p.reconstructActiveFormattingElements()
p.addText(d)
p.framesetOK = false
if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
// There were non-whitespace characters inserted.
p.framesetOK = false
}
case StartTagToken:
switch p.tok.DataAtom {
case a.Html:

View File

@ -1,9 +1,9 @@
PASS "FOO&#x000D;ZOO"
PASS "<html>\x00<frameset></frameset>"
FAIL "<html> \x00 <frameset></frameset>"
PASS "<html> \x00 <frameset></frameset>"
PASS "<html>a\x00a<frameset></frameset>"
PASS "<html>\x00\x00<frameset></frameset>"
FAIL "<html>\x00\n <frameset></frameset>"
PASS "<html>\x00\n <frameset></frameset>"
FAIL "<html><select>\x00"
PASS "\x00"
PASS "<body>\x00"

View File

@ -45,7 +45,7 @@ PASS "<html><frameset></frameset></html><!doctype html>"
PASS "<!doctype html><body><frameset>"
PASS "<!doctype html><p><frameset><frame>"
PASS "<!doctype html><p>a<frameset>"
FAIL "<!doctype html><p> <frameset><frame>"
PASS "<!doctype html><p> <frameset><frame>"
PASS "<!doctype html><pre><frameset>"
PASS "<!doctype html><listing><frameset>"
PASS "<!doctype html><li><frameset>"
@ -72,7 +72,7 @@ PASS "<!doctype html><iframe></iframe><frameset>"
PASS "<!doctype html><select></select><frameset>"
PASS "<!doctype html><svg></svg><frameset><frame>"
PASS "<!doctype html><math></math><frameset><frame>"
FAIL "<!doctype html><svg><foreignObject><div> <frameset><frame>"
PASS "<!doctype html><svg><foreignObject><div> <frameset><frame>"
PASS "<!doctype html><svg>a</svg><frameset><frame>"
PASS "<!doctype html><svg> </svg><frameset><frame>"
PASS "<html>aaa<frameset></frameset>"