Skip to content

Commit 5c1a695

Browse files
committed
Fix html5lib#488: append document-child comments in document order in lxml
1 parent e749511 commit 5c1a695

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.pytest.expect

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,6 @@ u'html5lib/tests/testdata/tree-construction/tests8.dat::5::cElementTree::parser:
12971297
u'html5lib/tests/testdata/tree-construction/tests8.dat::5::cElementTree::parser::void-namespace': FAIL
12981298
u'html5lib/tests/testdata/tree-construction/tests8.dat::5::lxml::parser::namespaced': FAIL
12991299
u'html5lib/tests/testdata/tree-construction/tests8.dat::5::lxml::parser::void-namespace': FAIL
1300-
u'html5lib/tests/testdata/tree-construction/webkit01.dat::22::lxml::parser::namespaced': FAIL
1301-
u'html5lib/tests/testdata/tree-construction/webkit01.dat::22::lxml::parser::void-namespace': FAIL
13021300
u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::namespaced': FAIL
13031301
u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::void-namespace': FAIL
13041302
u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::ElementTree::parser::namespaced': FAIL

html5lib/treebuilders/etree_lxml.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ def __init__(self):
4444
self._childNodes = []
4545

4646
def appendChild(self, element):
47-
self._elementTree.getroot().addnext(element._element)
47+
last = self._elementTree.getroot()
48+
for last in self._elementTree.getroot().itersiblings():
49+
pass
50+
51+
last.addnext(element._element)
4852

4953
def _getChildNodes(self):
5054
return self._childNodes

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy