summaryrefslogtreecommitdiff
path: root/bs4/builder/_html5lib.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-09 12:15:36 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-09 12:15:36 -0500
commitcaeb168dc47470607b3cd091e1d35db45c089385 (patch)
tree80990fdc7c12fdf0c4109ef3c0ad8a4eb358b61e /bs4/builder/_html5lib.py
parent5261e6c36d0f0c6cea364390dbe9f4cce66306e8 (diff)
Patched over a bug in html5lib (?) that was crashing Beautiful Soup on certain kinds of markup. [bug=838800]
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