diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-19 21:20:54 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-19 21:20:54 -0500 |
commit | 9a936b48fe05666780662c76d5df3b3de7b48074 (patch) | |
tree | 766662556ae441c5474e754fe9d582ffce3ff257 | |
parent | 86ae2ed0a644f124475a4aff3b34e229f5b7ec8f (diff) |
Oh, good, html5lib correctly handles literals in <textarea> tags.
-rw-r--r-- | tests/test_html5lib.py | 6 | ||||
-rw-r--r-- | tests/test_lxml.py | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_html5lib.py b/tests/test_html5lib.py index 3045b02..336f9a5 100644 --- a/tests/test_html5lib.py +++ b/tests/test_html5lib.py @@ -40,6 +40,12 @@ class TestHTML5Builder(TestLXMLBuilder): "<tbody><tr><td>Bar</td></tr></tbody>" "<tfoot><tr><td>Baz</td></tr></tfoot></table>") + def test_literal_in_textarea(self): + markup = '<textarea>Junk like <b> tags and <&<&</textarea>' + soup = self.soup(markup) + self.assertEquals( + soup.textarea.contents, ["Junk like <b> tags and <&<&"]) + def test_collapsed_whitespace(self): """Whitespace is preserved even in tags that don't require it.""" self.assertSoupEquals("<p> </p>") diff --git a/tests/test_lxml.py b/tests/test_lxml.py index 7597552..8670806 100644 --- a/tests/test_lxml.py +++ b/tests/test_lxml.py @@ -126,10 +126,9 @@ class TestLXMLBuilder(SoupTest): def test_literal_in_textarea(self): # Anything inside a <textarea> is supposed to be treated as - # the literal value of the field, (XXX citation needed). - # - # But, both lxml and html5lib do their best to parse the - # contents of a <textarea> as HTML. + # the literal value of the field, (XXX citation + # needed). html5lib does this correctly. But, lxml does its + # best to parse the contents of a <textarea> as HTML. text = '<textarea>Junk like <b> tags and <&<&</textarea>' soup = self.soup(text) self.assertEquals(len(soup.textarea.contents), 2) |