Skip to content

Commit fb68f8c

Browse files
committed
Fix #488: append document-child comments in document order in lxml
1 parent 2ea55c7 commit fb68f8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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)