aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs44
1 files changed, 20 insertions, 24 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 8aa54aafd2a..a8dd8972ca0 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -248,11 +248,11 @@ impl Node {
assert!(new_child.next_sibling.get().is_none());
match before {
Some(ref before) => {
- assert!(before.parent_node.get_rooted().r() == Some(self));
+ assert!(before.parent_node.get().r() == Some(self));
let prev_sibling = before.GetPreviousSibling();
match prev_sibling {
None => {
- assert!(Some(*before) == self.first_child.get_rooted().r());
+ assert!(Some(*before) == self.first_child.get().r());
self.first_child.set(Some(new_child));
},
Some(ref prev_sibling) => {
@@ -293,7 +293,7 @@ impl Node {
///
/// Fails unless `child` is a child of this node.
fn remove_child(&self, child: &Node) {
- assert!(child.parent_node.get_rooted().r() == Some(self));
+ assert!(child.parent_node.get().r() == Some(self));
let prev_sibling = child.GetPreviousSibling();
match prev_sibling {
None => {
@@ -670,7 +670,7 @@ impl Node {
let doc = self.owner_doc();
let node = try!(doc.r().node_from_nodes_and_strings(nodes));
// Step 2.
- let first_child = self.first_child.get_rooted();
+ let first_child = self.first_child.get();
Node::pre_insert(node.r(), self, first_child.r()).map(|_| ())
}
@@ -885,8 +885,8 @@ fn first_node_not_in<I>(mut nodes: I, not_in: &[NodeOrString]) -> Option<Root<No
{
nodes.find(|node| {
not_in.iter().all(|n| {
- match n {
- &NodeOrString::eNode(ref n) => n != node,
+ match *n {
+ NodeOrString::eNode(ref n) => n != node,
_ => true,
}
})
@@ -1648,7 +1648,7 @@ impl Node {
let node_elem = node.downcast::<Element>().unwrap();
let copy_elem = copy.downcast::<Element>().unwrap();
- for attr in node_elem.attrs().iter().map(JS::root) {
+ for attr in node_elem.attrs().iter() {
copy_elem.push_new_attribute(attr.local_name().clone(),
attr.value().clone(),
attr.name().clone(),
@@ -1719,12 +1719,10 @@ impl Node {
let prefix_atom = prefix.as_ref().map(|s| Atom::from_slice(s));
// Step 2.
- let namespace_attr =
- element.attrs()
- .iter()
- .map(|attr| attr.root())
- .find(|attr| attr_defines_namespace(attr.r(),
- &prefix_atom));
+ let attrs = element.attrs();
+ let namespace_attr = attrs.iter().find(|attr| {
+ attr_defines_namespace(attr, &prefix_atom)
+ });
// Steps 2.1-2.
if let Some(attr) = namespace_attr {
@@ -1818,7 +1816,7 @@ impl NodeMethods for Node {
// https://dom.spec.whatwg.org/#dom-node-parentnode
fn GetParentNode(&self) -> Option<Root<Node>> {
- self.parent_node.get_rooted()
+ self.parent_node.get()
}
// https://dom.spec.whatwg.org/#dom-node-parentelement
@@ -1842,22 +1840,22 @@ impl NodeMethods for Node {
// https://dom.spec.whatwg.org/#dom-node-firstchild
fn GetFirstChild(&self) -> Option<Root<Node>> {
- self.first_child.get_rooted()
+ self.first_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-lastchild
fn GetLastChild(&self) -> Option<Root<Node>> {
- self.last_child.get_rooted()
+ self.last_child.get()
}
// https://dom.spec.whatwg.org/#dom-node-previoussibling
fn GetPreviousSibling(&self) -> Option<Root<Node>> {
- self.prev_sibling.get_rooted()
+ self.prev_sibling.get()
}
// https://dom.spec.whatwg.org/#dom-node-nextsibling
fn GetNextSibling(&self) -> Option<Root<Node>> {
- self.next_sibling.get_rooted()
+ self.next_sibling.get()
}
// https://dom.spec.whatwg.org/#dom-node-nodevalue
@@ -2154,12 +2152,10 @@ impl NodeMethods for Node {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attrs = element.attrs();
attrs.iter().all(|attr| {
- let attr = attr.root();
other_element.attrs().iter().any(|other_attr| {
- let other_attr = other_attr.root();
- (*attr.r().namespace() == *other_attr.r().namespace()) &&
- (attr.r().local_name() == other_attr.r().local_name()) &&
- (**attr.r().value() == **other_attr.r().value())
+ (*attr.namespace() == *other_attr.namespace()) &&
+ (attr.local_name() == other_attr.local_name()) &&
+ (**attr.value() == **other_attr.value())
})
})
}
@@ -2360,7 +2356,7 @@ impl VirtualMethods for Node {
self.children_count.set(added.len() as u32);
},
}
- if let Some(list) = self.child_list.get_rooted() {
+ if let Some(list) = self.child_list.get() {
list.as_children_list().children_changed(mutation);
}
}