aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/nodelist.rs
diff options
context:
space:
mode:
authorKeith Yeung <kungfukeith11@gmail.com>2016-01-22 22:44:48 -0500
committerKeith Yeung <kungfukeith11@gmail.com>2016-01-28 18:33:51 -0500
commit4229b68062a603a14a63952c0e010de3b0145c15 (patch)
tree587fc33a4beecb63c1dd524608ead8b3d2601ca4 /components/script/dom/nodelist.rs
parent9e3af70941c74eed41f47ff13d0fc7cfd2300403 (diff)
downloadservo-4229b68062a603a14a63952c0e010de3b0145c15.tar.gz
servo-4229b68062a603a14a63952c0e010de3b0145c15.zip
Implement NamedItem and NamedGetter on HTMLFormControlsCollection
Diffstat (limited to 'components/script/dom/nodelist.rs')
-rw-r--r--components/script/dom/nodelist.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs
index 5987b1b26f0..2d1bbe363a7 100644
--- a/components/script/dom/nodelist.rs
+++ b/components/script/dom/nodelist.rs
@@ -41,8 +41,7 @@ impl NodeList {
GlobalRef::Window(window), NodeListBinding::Wrap)
}
- pub fn new_simple_list<T>(window: &Window, iter: T)
- -> Root<NodeList>
+ pub fn new_simple_list<T>(window: &Window, iter: T) -> Root<NodeList>
where T: Iterator<Item=Root<Node>> {
NodeList::new(window, NodeListType::Simple(iter.map(|r| JS::from_rooted(&r)).collect()))
}
@@ -93,8 +92,12 @@ impl NodeList {
}
}
- pub fn get_list_type(&self) -> &NodeListType {
- &self.list_type
+ pub fn as_simple_list(&self) -> &Vec<JS<Node>> {
+ if let NodeListType::Simple(ref list) = self.list_type {
+ list
+ } else {
+ panic!("called as_simple_list() on a children node list")
+ }
}
}
@@ -108,7 +111,7 @@ pub struct ChildrenList {
}
impl ChildrenList {
- fn new(node: &Node) -> ChildrenList {
+ pub fn new(node: &Node) -> ChildrenList {
let last_visited = node.GetFirstChild();
ChildrenList {
node: JS::from_ref(node),
@@ -117,10 +120,6 @@ impl ChildrenList {
}
}
- pub fn get_parent_node(&self) -> &Node {
- &*self.node
- }
-
pub fn len(&self) -> u32 {
self.node.children_count()
}