Mercurial > genshi > genshi-test
changeset 178:8fb7df2e1281
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 | dbae9efe5704 |
children | a2e0a7986d19 |
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[*/