# HG changeset patch
# User cmlenz
# Date 1205354932 0
# Node ID 3881a602048acf69be4939d3fbf4285be44ecee2
# Parent d8571da25bc54caa8a6c04332bd99e4b08bc8b66
The XHTML serializer now strips `xml:space` attributes as they are only allowed on very few tags.
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,8 @@
* The `Stream.render` now accepts an optional `out` parameter that can be
used to pass in a writable file-like object to use for assembling the
output, instead of building a big string and returning it.
+ * The XHTML serializer now strips `xml:space` attributes as they are only
+ allowed on very few tags.
Version 0.4.4
diff --git a/genshi/output.py b/genshi/output.py
--- a/genshi/output.py
+++ b/genshi/output.py
@@ -309,6 +309,8 @@
value = attr
elif attr == u'xml:lang' and u'lang' not in attrib:
buf += [' lang="', escape(value), '"']
+ elif attr == u'xml:space':
+ continue
buf += [' ', attr, '="', escape(value), '"']
if kind is EMPTY:
if tag in empty_elems:
diff --git a/genshi/tests/output.py b/genshi/tests/output.py
--- a/genshi/tests/output.py
+++ b/genshi/tests/output.py
@@ -228,7 +228,7 @@
def test_xml_space(self):
text = ' Do not mess \n\n with me '
output = XML(text).render(XHTMLSerializer)
- self.assertEqual(text, output)
+ self.assertEqual(' Do not mess \n\n with me ', output)
def test_empty_script(self):
text = """