diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bs4/element.py b/bs4/element.py index caa855e..da9afdf 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -484,16 +484,17 @@ class PageElement(object): strainer = SoupStrainer(name, attrs, text, **kwargs) if text is None and not limit and not attrs and not kwargs: - # Optimization to find all tags. if name is True or name is None: + # Optimization to find all tags. result = (element for element in generator if isinstance(element, Tag)) - ResultSet(strainer, result) - # Optimization to find all tags with a given name. + return ResultSet(strainer, result) elif isinstance(name, basestring): + # Optimization to find all tags with a given name. result = (element for element in generator if isinstance(element, Tag) and element.name == name) + return ResultSet(strainer, result) results = ResultSet(strainer) while True: try: |