summaryrefslogtreecommitdiff
path: root/bs4/builder/_html5lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/builder/_html5lib.py')
-rw-r--r--bs4/builder/_html5lib.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bs4/builder/_html5lib.py b/bs4/builder/_html5lib.py
index 11fcc0d..4b80870 100644
--- a/bs4/builder/_html5lib.py
+++ b/bs4/builder/_html5lib.py
@@ -195,7 +195,10 @@ class Element(html5lib.treebuilders._base.Node):
def removeChild(self, node):
index = self._nodeIndex(node.parent, node)
- del node.parent.element.contents[index]
+ # XXX This if statement is problematic:
+ # https://bugs.launchpad.net/beautifulsoup/+bug/838800
+ if index is not None:
+ del node.parent.element.contents[index]
node.element.parent = None
node.element.extract()
node.parent = None