summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--beautifulsoup/element.py11
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3d82e32..907675f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,8 @@ You can write this:
for parent in tag.parents:
...
+(But the old code will still work.)
+
== tag.string is recursive ==
tag.string now operates recursively. If tag A contains a single tag B
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py
index e3144b4..80ab7ba 100644
--- a/beautifulsoup/element.py
+++ b/beautifulsoup/element.py
@@ -709,7 +709,7 @@ class Tag(PageElement, Entities):
same is true of the tag name."""
generator = self.recursive_children
if not recursive:
- generator = self.childGenerator
+ generator = self.children
return self._find_all(name, attrs, text, limit, generator, **kwargs)
# Old names for backwards compatibility.
@@ -728,7 +728,8 @@ class Tag(PageElement, Entities):
return self.attrMap
#Generator methods
- def childGenerator(self):
+ @property
+ def children(self):
for i in range(0, len(self.contents)):
yield self.contents[i]
raise StopIteration
@@ -742,7 +743,11 @@ class Tag(PageElement, Entities):
while current is not stopNode:
yield current
current = current.next
- # Old name for backwards compatibility
+
+ # Old names for backwards compatibility
+ def childGenerator(self):
+ return self.children
+
def recursiveChildGenerator(self):
return self.recursive_children