diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go
index 38e61677e3..afdfc9989c 100644
--- a/src/pkg/exp/html/parse.go
+++ b/src/pkg/exp/html/parse.go
@@ -1902,6 +1902,11 @@ func parseForeignContent(p *parser) bool {
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
tag).
+ p.tokenizer.rawTag = ""
+ }
if p.hasSelfClosingToken {
p.oe.pop()
p.acknowledgeSelfClosingTag()
diff --git a/src/pkg/exp/html/render.go b/src/pkg/exp/html/render.go
index 07859faa7d..de9706528f 100644
--- a/src/pkg/exp/html/render.go
+++ b/src/pkg/exp/html/render.go
@@ -209,7 +209,7 @@ func render1(w writer, n *Node) error {
}
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 {
diff --git a/src/pkg/exp/html/testlogs/tests10.dat.log b/src/pkg/exp/html/testlogs/tests10.dat.log
index edf75d689a..bf9434b257 100644
--- a/src/pkg/exp/html/testlogs/tests10.dat.log
+++ b/src/pkg/exp/html/testlogs/tests10.dat.log
@@ -33,7 +33,7 @@ PASS "a"
PASS "