diff --git a/src/pkg/exp/html/foreign.go b/src/pkg/exp/html/foreign.go
index 99b7a6535d..89eef3dcb5 100644
--- a/src/pkg/exp/html/foreign.go
+++ b/src/pkg/exp/html/foreign.go
@@ -37,8 +37,16 @@ func htmlIntegrationPoint(n *Node) bool {
}
switch n.Namespace {
case "math":
- // TODO: annotation-xml elements whose start tags have "text/html" or
- // "application/xhtml+xml" encodings.
+ if n.Data == "annotation-xml" {
+ for _, a := range n.Attr {
+ if a.Key == "encoding" {
+ val := strings.ToLower(a.Val)
+ if val == "text/html" || val == "application/xhtml+xml" {
+ return true
+ }
+ }
+ }
+ }
case "svg":
switch n.Data {
case "desc", "foreignObject", "title":
@@ -48,6 +56,17 @@ func htmlIntegrationPoint(n *Node) bool {
return false
}
+func mathMLTextIntegrationPoint(n *Node) bool {
+ if n.Namespace != "math" {
+ return false
+ }
+ switch n.Data {
+ case "mi", "mo", "mn", "ms", "mtext":
+ return true
+ }
+ return false
+}
+
// Section 12.2.5.5.
var breakout = map[string]bool{
"b": true,
diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go
index d4fcdca4e4..1544bee26d 100644
--- a/src/pkg/exp/html/parse.go
+++ b/src/pkg/exp/html/parse.go
@@ -1859,8 +1859,23 @@ func (p *parser) inForeignContent() bool {
if n.Namespace == "" {
return false
}
- // TODO: MathML, HTML integration points.
- // TODO: MathML's annotation-xml combining with SVG's svg.
+ if mathMLTextIntegrationPoint(n) {
+ if p.tok.Type == StartTagToken && p.tok.Data != "mglyph" && p.tok.Data != "malignmark" {
+ return false
+ }
+ if p.tok.Type == TextToken {
+ return false
+ }
+ }
+ if n.Namespace == "math" && n.Data == "annotation-xml" && p.tok.Type == StartTagToken && p.tok.Data == "svg" {
+ return false
+ }
+ if htmlIntegrationPoint(n) && (p.tok.Type == StartTagToken || p.tok.Type == TextToken) {
+ return false
+ }
+ if p.tok.Type == ErrorToken {
+ return false
+ }
return true
}
diff --git a/src/pkg/exp/html/testlogs/pending-spec-changes.dat.log b/src/pkg/exp/html/testlogs/pending-spec-changes.dat.log
index cc0ffb015d..71d0170399 100644
--- a/src/pkg/exp/html/testlogs/pending-spec-changes.dat.log
+++ b/src/pkg/exp/html/testlogs/pending-spec-changes.dat.log
@@ -1,3 +1,3 @@
PASS "