# HG changeset patch
# User cmlenz
# Date 1156174589 0
# Node ID 8fb7df2e1281bded47e79305e3dcae4c3c84f8ad
# Parent dbae9efe57045200371d069be61f72cce185daed
Fix bug in XHTML serialization: all elements were allowed to be written out as empty if the namespace was set.
diff --git a/markup/output.py b/markup/output.py
--- 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 += [' />']
diff --git a/markup/tests/output.py b/markup/tests/output.py
--- a/markup/tests/output.py
+++ b/markup/tests/output.py
@@ -95,9 +95,13 @@
self.assertEqual(text, output)
def test_empty_script(self):
- text = ''
+ text = """
+
+ """
output = XML(text).render(XHTMLSerializer)
- self.assertEqual('', output)
+ self.assertEqual("""
+
+ """, output)
def test_script_escaping(self):
text = """