The content of an HTML <title> element is RCDATA, but the content of an SVG
<title> element is parsed as tags. Now the parser doesn't go into RCDATA
mode in foreign content.
Pass 4 additional tests.
R=nigeltao
CC=golang-dev
https://golang.org/cl/
6448111
namespace := p.top().Namespace
p.addElement()
p.top().Namespace = namespace
+ if namespace != "" {
+ // Don't let the tokenizer go into raw text mode in foreign content
+ // (e.g. in an SVG <title> tag).
+ p.tokenizer.rawTag = ""
+ }
if p.hasSelfClosingToken {
p.oe.pop()
p.acknowledgeSelfClosingTag()
}
case "textarea", "title":
for _, c := range n.Child {
- if c.Type != TextNode {
+ if c.Type != TextNode && n.Namespace == "" {
return fmt.Errorf("html: RCDATA element <%s> has non-text child node", n.Data)
}
if err := render1(w, c); err != nil {
PASS "<!DOCTYPE html><svg><desc><div><svg><ul>a"
PASS "<!DOCTYPE html><svg><desc><svg><ul>a"
PASS "<!DOCTYPE html><p><svg><desc><p>"
-FAIL "<!DOCTYPE html><p><svg><title><p>"
+PASS "<!DOCTYPE html><p><svg><title><p>"
PASS "<div><svg><path><foreignObject><p></foreignObject><p>"
PASS "<math><mi><div><object><div><span></span></div></object></div></mi><mi>"
PASS "<math><mi><svg><foreignObject><div><div></div></div></foreignObject></svg></mi><mi>"
PASS "<a><li><style></style><title></title></a>"
PASS "<font></p><p><meta><title></title></font>"
PASS "<a><center><title></title><a>"
-FAIL "<svg><title><div>"
-FAIL "<svg><title><rect><div>"
-FAIL "<svg><title><svg><div>"
+PASS "<svg><title><div>"
+PASS "<svg><title><rect><div>"
+PASS "<svg><title><svg><div>"
PASS "<img <=\"\" FAIL>"
FAIL "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>"
PASS "<svg><em><desc></em>"