JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
create wysiwyg elements in correct namespace
authorJason Woofenden <jason@jasonwoof.com>
Wed, 7 Jun 2017 04:11:16 +0000 (00:11 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Wed, 7 Jun 2017 04:11:16 +0000 (00:11 -0400)
editor.js

index 72e8506..9a3a2f5 100644 (file)
--- a/editor.js
+++ b/editor.js
@@ -432,8 +432,13 @@ function instantiate_tree (tree, parent) {
                                        remove.unshift(i) // add to beginning so they are removed last first
                                        continue
                                }
-                               // TODO create in correct namespace
-                               c.el = parent.ownerDocument.createElement(c.name)
+                               if (c.namespace === 'svg') {
+                                       c.el = parent.ownerDocument.createElementNS('http://www.w3.org/2000/svg', c.name)
+                               } else if (c.namespace === 'mathml') {
+                                       c.el = parent.ownerDocument.createElementNS('http://www.w3.org/1998/Math/MathML', c.name)
+                               } else {
+                                       c.el = parent.ownerDocument.createElement(c.name)
+                               }
                                ref1 = c.attrs
                                for (k in ref1) {
                                        v = ref1[k]