Mercurial > genshi > mirror
diff markup/tests/output.py @ 143:3d4c214c979a trunk
CDATA sections in XML input now appear as CDATA sections in the output. This should address the problem with escaping the contents of `<style>` and `<script>` elements, which would only get interpreted correctly if the output was served as `application/xhtml+xml`. Closes #24.
author | cmlenz |
---|---|
date | Fri, 11 Aug 2006 14:08:13 +0000 |
parents | 520a5b7dd6d2 |
children | 3f23fafeef99 |
line wrap: on
line diff
--- a/markup/tests/output.py +++ b/markup/tests/output.py @@ -95,16 +95,18 @@ self.assertEqual(text, output) def test_script_escaping(self): - text = '<script><![CDATA[if (1 < 2) { alert("Doh"); }]]></script>' + text = """<script>/*<![CDATA[*/ + if (1 < 2) { alert("Doh"); } + /*]]>*/</script>""" output = XML(text).render(XHTMLSerializer) - self.assertEqual('<script>if (1 < 2) { alert("Doh"); }</script>', - output) + self.assertEqual(text, output) def test_style_escaping(self): - text = '<style><![CDATA[html > body { display: none; }]]></style>' + text = """<style>/*<![CDATA[*/ + html > body { display: none; } + /*]]>*/</style>""" output = XML(text).render(XHTMLSerializer) - self.assertEqual('<style>html > body { display: none; }</style>', - output) + self.assertEqual(text, output) class HTMLSerializerTestCase(unittest.TestCase):