Skip to content

Commit c35d84c

Browse files
committed
Fix #217: Fully remove element in removeChild in etree treebuilder (#259)
This adds a test here because we still fail the upstream one, as our implementation of AAA is outdated.
1 parent 2d37673 commit c35d84c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

html5lib/tests/test_parser2.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from . import support # noqa
88

99
from html5lib.constants import namespaces
10-
from html5lib import parse, HTMLParser
10+
from html5lib import parse, parseFragment, HTMLParser
1111

1212

1313
# tests that aren't autogenerated from text files
@@ -88,3 +88,8 @@ def test_debug_log():
8888
expected[i] = tuple(log)
8989

9090
assert parser.log == expected
91+
92+
93+
def test_no_duplicate_clone():
94+
frag = parseFragment("<b><em><foo><foob><fooc><aside></b></em>")
95+
assert len(frag) == 2

html5lib/treebuilders/etree.py

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def insertBefore(self, node, refNode):
100100
node.parent = self
101101

102102
def removeChild(self, node):
103+
self._childNodes.remove(node)
103104
self._element.remove(node._element)
104105
node.parent = None
105106

0 commit comments

Comments
 (0)