JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix main loop, process foreign content
[peach-html5-editor.git] / test.coffee
index 3098bbd..274940b 100644 (file)
@@ -7796,15 +7796,23 @@ serialize_els = (els, prefix = '| ') ->
        for el in els
                switch el.type
                        when wheic.TYPE_TAG
-                               ret += "#{prefix}<#{el.name}>\n"
+                               ret += "#{prefix}<"
+                               if el.namespace is wheic.NS_MATHML
+                                       ret += "math "
+                               if el.namespace is wheic.NS_SVG
+                                       ret += "svg "
+                               ret += "#{el.name}>\n"
                                attr_keys = []
                                for k of el.attrs
                                        attr_keys.push k
                                attr_keys.sort() # TODO this should be "lexicographically by UTF-16 code unit"
                                for k in attr_keys
                                        ret += "#{prefix}  #{k}=\"#{el.attrs[k]}\"\n"
-                               # FIXME template shows as "content" with children below it
-                               ret += serialize_els el.children, "#{prefix}  "
+                               if el.name is 'template' # ?check ns
+                                       ret += "#{prefix}  content\n"
+                                       ret += serialize_els el.children, "#{prefix}    "
+                               else
+                                       ret += serialize_els el.children, "#{prefix}  "
                        when wheic.TYPE_TEXT
                                ret += "#{prefix}\"#{el.text}\"\n"
                        when wheic.TYPE_COMMENT