Skip to content

Fix #217: Fully remove element in removeChild in etree treebuilder #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion html5lib/tests/test_parser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import support # noqa

from html5lib.constants import namespaces
from html5lib import parse, HTMLParser
from html5lib import parse, parseFragment, HTMLParser


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

assert parser.log == expected


def test_no_duplicate_clone():
frag = parseFragment("<b><em><foo><foob><fooc><aside></b></em>")
assert len(frag) == 2
1 change: 1 addition & 0 deletions html5lib/treebuilders/etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def insertBefore(self, node, refNode):
node.parent = self

def removeChild(self, node):
self._childNodes.remove(node)
self._element.remove(node._element)
node.parent = None

Expand Down