changeset 178:ba7556e3a835 trunk

Fix bug in XHTML serialization: all elements were allowed to be written out as empty if the namespace was set.
author cmlenz
date Mon, 21 Aug 2006 15:36:29 +0000
parents 553866249cb0
children 13909179e5e1
files markup/output.py markup/tests/output.py
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/markup/output.py
+++ b/markup/output.py
@@ -231,7 +231,7 @@
                         buf += [' ', attrname, '="', escape(value), '"']
                 ns_attrib = []
 
-                if (tagns and tagns != namespace) or tagname in empty_elems:
+                if (tagns and tagns != namespace.uri) or tagname in empty_elems:
                     kind, data, pos = stream.next()
                     if kind is END:
                         buf += [' />']
--- a/markup/tests/output.py
+++ b/markup/tests/output.py
@@ -95,9 +95,13 @@
         self.assertEqual(text, output)
 
     def test_empty_script(self):
-        text = '<script src="foo.js" />'
+        text = """<html xmlns="http://www.w3.org/1999/xhtml">
+            <script src="foo.js" />
+        </html>"""
         output = XML(text).render(XHTMLSerializer)
-        self.assertEqual('<script src="foo.js"></script>', output)
+        self.assertEqual("""<html xmlns="http://www.w3.org/1999/xhtml">
+            <script src="foo.js"></script>
+        </html>""", output)
 
     def test_script_escaping(self):
         text = """<script>/*<![CDATA[*/
Copyright (C) 2012-2017 Edgewall Software