diff options
-rw-r--r-- | NEWS.txt | 3 | ||||
-rw-r--r-- | bs4/builder/_html5lib.py | 5 |
2 files changed, 7 insertions, 1 deletions
@@ -20,6 +20,9 @@ * Unicode, Dammit now detects the encoding in HTML 5-style <meta> tags like <meta charset="utf-8" />. [bug=837268] +* Patched over a bug in html5lib (?) that was crashing Beautiful Soup + on certain kinds of markup. [bug=838800] + * Fixed a bug that wrecked the tree if you replaced an element with an empty string. [bug=728697] 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 |