diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-28 12:46:05 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-28 12:46:05 -0500 |
commit | 447a2243c9997082704b33cc69f2fe1024034f68 (patch) | |
tree | cde0d2f819a9a9ce491730af90dc5be3f99b0889 | |
parent | e25154f75f97ab60e33cbde13ff9c892d4e2d9f9 (diff) |
Minor changes.
-rw-r--r-- | bs4/element.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/bs4/element.py b/bs4/element.py index 46554d1..6fb6210 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -370,6 +370,7 @@ class Comment(NavigableString): PREFIX = u'<!--' SUFFIX = u'-->' + class Declaration(NavigableString): PREFIX = u'<!' SUFFIX = u'!>' @@ -508,10 +509,7 @@ class Tag(PageElement): def __eq__(self, other): """Returns true iff this tag has the same name, the same attributes, - and the same contents (recursively) as the given tag. - - XXX: right now this will return false if two tags have the - same attributes in a different order. Should this be fixed?""" + and the same contents (recursively) as the given tag.""" if not hasattr(other, 'name') or not hasattr(other, 'attrs') or not hasattr(other, 'contents') or self.name != other.name or self.attrs != other.attrs or len(self) != len(other): return False for i in range(0, len(self.contents)): @@ -686,14 +684,12 @@ class Tag(PageElement): #Generator methods @property def children(self): - for i in range(0, len(self.contents)): - yield self.contents[i] - raise StopIteration + return iter(self.contents) # XXX This seems to be untested. @property def recursive_children(self): if not len(self.contents): - raise StopIteration + raise StopIteration # XXX return instead? stopNode = self._last_recursive_child().next current = self.contents[0] while current is not stopNode: |