html: add missing special elements for <svg> and <math>
See: https://html.spec.whatwg.org/multipage/parsing.html#special
Change-Id: Ief3f0c04d2c7530a44221cb8fa2e22dd6d8b8427
Reviewed-on: https://go-review.googlesource.com/136876
Reviewed-by: Nigel Tao <nigeltao@golang.org>
diff --git a/html/const.go b/html/const.go
index 5eb7c5a..a3a918f 100644
--- a/html/const.go
+++ b/html/const.go
@@ -97,8 +97,16 @@
switch element.Namespace {
case "", "html":
return isSpecialElementMap[element.Data]
+ case "math":
+ switch element.Data {
+ case "mi", "mo", "mn", "ms", "mtext", "annotation-xml":
+ return true
+ }
case "svg":
- return element.Data == "foreignObject"
+ switch element.Data {
+ case "foreignObject", "desc", "title":
+ return true
+ }
}
return false
}