aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/page.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/page.rs')
-rw-r--r--components/script/page.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/components/script/page.rs b/components/script/page.rs
index 67cb1ca46ed..cedbb02bd74 100644
--- a/components/script/page.rs
+++ b/components/script/page.rs
@@ -100,15 +100,11 @@ impl Iterator for PageIterator {
type Item = Rc<Page>;
fn next(&mut self) -> Option<Rc<Page>> {
- match self.stack.pop() {
- Some(next) => {
- for child in &*next.children.borrow() {
- self.stack.push(child.clone());
- }
- Some(next)
- },
- None => None,
+ let popped = self.stack.pop();
+ if let Some(ref page) = popped {
+ self.stack.extend(page.children.borrow().iter().cloned());
}
+ popped
}
}