From d1365a072537d028e6513782298eb2a7334ee02c Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 17 Jul 2016 11:50:48 -0400 Subject: Fixed a bug in the html5lib treebuilder that deranged the tree when a whitespace element was reparented into a tag that contained an identical whitespace element. [bug=1505351] --- bs4/tests/test_html5lib.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bs4/tests/test_html5lib.py') diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py index 65536c2..8e3cba6 100644 --- a/bs4/tests/test_html5lib.py +++ b/bs4/tests/test_html5lib.py @@ -84,6 +84,17 @@ class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): self.assertEqual(u"

foo

\n

bar

\n", soup.body.decode()) self.assertEqual(2, len(soup.find_all('p'))) + def test_reparented_markup_containing_identical_whitespace_nodes(self): + """Verify that we keep the two whitespace nodes in this + document distinct when reparenting the adjacent tags. + """ + markup = '
' + soup = self.soup(markup) + space1, space2 = soup.find_all(string=' ') + tbody1, tbody2 = soup.find_all('tbody') + assert space1.next_element is tbody1 + assert tbody2.next_element is space2 + def test_processing_instruction(self): """Processing instructions become comments.""" markup = b"""""" -- cgit v1.2.1