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.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 07ea03b1f81..befecda4e11 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -7,6 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMetho
use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast};
use dom::bindings::global::Window;
use dom::bindings::js::{JS, JSRef, Temporary};
+use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::element::{Element, AttributeHandlers, ElementHelpers};
use dom::node::{Node, NodeHelpers};
@@ -15,27 +16,20 @@ use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use servo_util::str::{DOMString, split_html_space_chars};
-use serialize::{Encoder, Encodable};
use std::ascii::StrAsciiExt;
-pub trait CollectionFilter {
+pub trait CollectionFilter : JSTraceable {
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool;
}
-impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter+'static> {
- fn encode(&self, _s: &mut S) -> Result<(), E> {
- Ok(())
- }
-}
-
-#[deriving(Encodable)]
+#[jstraceable]
#[must_root]
pub enum CollectionTypeId {
Static(Vec<JS<Element>>),
Live(JS<Node>, Box<CollectionFilter+'static>)
}
-#[deriving(Encodable)]
+#[jstraceable]
#[must_root]
pub struct HTMLCollection {
collection: CollectionTypeId,
@@ -64,6 +58,7 @@ impl HTMLCollection {
fn all_elements(window: JSRef<Window>, root: JSRef<Node>,
namespace_filter: Option<Namespace>) -> Temporary<HTMLCollection> {
+ #[jstraceable]
struct AllElementFilter {
namespace_filter: Option<Namespace>
}
@@ -85,6 +80,7 @@ impl HTMLCollection {
return HTMLCollection::all_elements(window, root, None);
}
+ #[jstraceable]
struct TagNameFilter {
tag: Atom,
ascii_lower_tag: Atom,
@@ -115,6 +111,7 @@ impl HTMLCollection {
if tag.as_slice() == "*" {
return HTMLCollection::all_elements(window, root, namespace_filter);
}
+ #[jstraceable]
struct TagNameNSFilter {
tag: Atom,
namespace_filter: Option<Namespace>
@@ -139,6 +136,7 @@ impl HTMLCollection {
pub fn by_class_name(window: JSRef<Window>, root: JSRef<Node>, classes: DOMString)
-> Temporary<HTMLCollection> {
+ #[jstraceable]
struct ClassNameFilter {
classes: Vec<DOMString>
}
@@ -154,6 +152,7 @@ impl HTMLCollection {
}
pub fn children(window: JSRef<Window>, root: JSRef<Node>) -> Temporary<HTMLCollection> {
+ #[jstraceable]
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool {