diff options
| author | Leonard Richardson <leonardr@segfault.org> | 2013-08-15 08:31:34 -0400 |
|---|---|---|
| committer | Leonard Richardson <leonardr@segfault.org> | 2013-08-15 08:31:34 -0400 |
| commit | dd223ac4913e461951b4325bb3826259d62d29a8 (patch) | |
| tree | f4d56982df75243443d12514e54e8e012a26f95c /bs4/element.py | |
| parent | 064439f3b2decfb55b4e118ac4d41851d13c4c6f (diff) | |
Make sure the optimized find_all() ResultSets actually contain the right data.
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: |
