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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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)
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