diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index 7b63b30..40b1631 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -258,7 +258,7 @@ class PageElement(object): def _last_descendant(self): "Finds the last element beneath this object to be parsed." last_child = self - while hasattr(last_child, 'contents') and last_child.contents: + while isinstance(last_child, Tag) and last_child.contents: last_child = last_child.contents[-1] return last_child # BS3: Not part of the API! |