Add links to spec for script::dom structs/methods

This commit is contained in:
Corey Farwell 2015-03-28 20:04:30 -04:00
parent e70beca74b
commit 46f14449d0
10 changed files with 36 additions and 0 deletions

View file

@ -17,6 +17,7 @@ pub enum NodeListType {
Children(JS<Node>)
}
// https://dom.spec.whatwg.org/#interface-nodelist
#[dom_struct]
pub struct NodeList {
reflector_: Reflector,
@ -47,6 +48,7 @@ impl NodeList {
}
impl<'a> NodeListMethods for JSRef<'a, NodeList> {
// https://dom.spec.whatwg.org/#dom-nodelist-length
fn Length(self) -> u32 {
match self.list_type {
NodeListType::Simple(ref elems) => elems.len() as u32,
@ -57,6 +59,7 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
}
}
// https://dom.spec.whatwg.org/#dom-nodelist-item
fn Item(self, index: u32) -> Option<Temporary<Node>> {
match self.list_type {
_ if index >= self.Length() => None,