mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add links to spec for script::dom structs/methods
This commit is contained in:
parent
e70beca74b
commit
46f14449d0
10 changed files with 36 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue