aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlcollection.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmlcollection.rs')
-rw-r--r--components/script/dom/htmlcollection.rs31
1 files changed, 6 insertions, 25 deletions
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index d36fb177e7b..25e17586f9b 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -11,7 +11,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::trace::JSTraceable;
use dom::bindings::xmlname::namespace_from_domstring;
use dom::element::Element;
-use dom::node::{Node, FollowingNodeIterator, PrecedingNodeIterator};
+use dom::node::Node;
use dom::window::Window;
use std::ascii::AsciiExt;
use std::cell::Cell;
@@ -208,7 +208,7 @@ impl HTMLCollection {
pub fn elements_iter_after(&self, after: &Node) -> HTMLCollectionElementsIter {
// Iterate forwards from a node.
HTMLCollectionElementsIter {
- node_iter: after.following_nodes(&self.root),
+ node_iter: box after.following_nodes(&self.root),
root: Root::from_ref(&self.root),
filter: &self.filter,
}
@@ -219,10 +219,10 @@ impl HTMLCollection {
self.elements_iter_after(&*self.root)
}
- pub fn elements_iter_before(&self, before: &Node) -> HTMLCollectionElementsRevIter {
+ pub fn elements_iter_before(&self, before: &Node) -> HTMLCollectionElementsIter {
// Iterate backwards from a node.
- HTMLCollectionElementsRevIter {
- node_iter: before.preceding_nodes(&self.root),
+ HTMLCollectionElementsIter {
+ node_iter: box before.preceding_nodes(&self.root),
root: Root::from_ref(&self.root),
filter: &self.filter,
}
@@ -232,7 +232,7 @@ impl HTMLCollection {
// TODO: Make this generic, and avoid code duplication
pub struct HTMLCollectionElementsIter<'a> {
- node_iter: FollowingNodeIterator,
+ node_iter: Box<Iterator<Item = Root<Node>>>,
root: Root<Node>,
filter: &'a Box<CollectionFilter>,
}
@@ -250,25 +250,6 @@ impl<'a> Iterator for HTMLCollectionElementsIter<'a> {
}
}
-pub struct HTMLCollectionElementsRevIter<'a> {
- node_iter: PrecedingNodeIterator,
- root: Root<Node>,
- filter: &'a Box<CollectionFilter>,
-}
-
-impl<'a> Iterator for HTMLCollectionElementsRevIter<'a> {
- type Item = Root<Element>;
-
- fn next(&mut self) -> Option<Self::Item> {
- let filter = &self.filter;
- let root = &self.root;
- self.node_iter.by_ref()
- .filter_map(Root::downcast)
- .filter(|element| filter.filter(&element, root))
- .next()
- }
-}
-
impl HTMLCollectionMethods for HTMLCollection {
// https://dom.spec.whatwg.org/#dom-htmlcollection-length
fn Length(&self) -> u32 {