mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Refactor code for fetching radio siblings
This commit is contained in:
parent
14a6e54371
commit
a5180a473d
2 changed files with 50 additions and 22 deletions
|
@ -81,3 +81,17 @@ impl Reflectable for NodeList {
|
|||
&self.reflector_
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NodeListHelpers {
|
||||
fn into_vec(self) -> Vec<Temporary<Node>>;
|
||||
}
|
||||
|
||||
|
||||
impl<'a> NodeListHelpers for JSRef<'a, NodeList> {
|
||||
fn into_vec(self) -> Vec<Temporary<Node>> {
|
||||
match self.list_type {
|
||||
Simple(ref elems) => elems.iter().map(|j| Temporary::new(*j)).collect(),
|
||||
Children(ref node) => vec![Temporary::new(*node)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue