diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/nodelist.rs | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 39b4cc1c41e..31e4dfb40c8 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -103,11 +103,9 @@ impl NodeList { } } - pub fn iter(&self) -> NodeListIterator { - NodeListIterator { - nodes: self, - offset: 0, - } + pub fn iter<'a>(&'a self) -> impl Iterator<Item=Root<Node>> + 'a { + let len = self.Length(); + (0..len).flat_map(move |i| self.Item(i)) } } @@ -289,18 +287,3 @@ impl ChildrenList { self.last_index.set(0u32); } } - -pub struct NodeListIterator<'a> { - nodes: &'a NodeList, - offset: u32, -} - -impl<'a> Iterator for NodeListIterator<'a> { - type Item = Root<Node>; - - fn next(&mut self) -> Option<Root<Node>> { - let result = self.nodes.Item(self.offset); - self.offset = self.offset + 1; - result - } -} |