aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/node.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-06-10 14:46:43 +0200
committerMs2ger <ms2ger@gmail.com>2014-06-11 19:51:07 +0200
commitd230077f9f269d8f46af07004dd659496f701044 (patch)
tree39edd01a2530e9dc27c2667c87f6a9e0bff89010 /src/components/script/dom/node.rs
parent6df6a7d51246307dddc314861a7e1e31963018b2 (diff)
downloadservo-d230077f9f269d8f46af07004dd659496f701044.tar.gz
servo-d230077f9f269d8f46af07004dd659496f701044.zip
Stop mutating Element::namespace.
Diffstat (limited to 'src/components/script/dom/node.rs')
-rw-r--r--src/components/script/dom/node.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs
index 181c99fe686..4a021abd582 100644
--- a/src/components/script/dom/node.rs
+++ b/src/components/script/dom/node.rs
@@ -1252,7 +1252,8 @@ impl Node {
ElementNodeTypeId(..) => {
let element: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
let element = element.deref();
- let element = build_element_from_tag(element.local_name.clone(), &*document);
+ let element = build_element_from_tag(element.local_name.clone(),
+ element.namespace.clone(), &*document);
NodeCast::from_temporary(element)
},
TextNodeTypeId => {
@@ -1289,22 +1290,16 @@ impl Node {
},
ElementNodeTypeId(..) => {
let node_elem: &JSRef<Element> = ElementCast::to_ref(node).unwrap();
- let node_elem = node_elem.deref();
- let copy_elem: &mut JSRef<Element> = ElementCast::to_mut_ref(&mut *copy).unwrap();
+ let copy_elem: &JSRef<Element> = ElementCast::to_ref(&*copy).unwrap();
- // XXX: to avoid double borrowing compile error. we might be able to fix this after #1854
- let copy_elem_alias = copy_elem.clone();
-
- let copy_elem = copy_elem.deref_mut();
// FIXME: https://github.com/mozilla/servo/issues/1737
- copy_elem.namespace = node_elem.namespace.clone();
let window = document.deref().window.root();
- for attr in node_elem.attrs.borrow().iter().map(|attr| attr.root()) {
- copy_elem.attrs.borrow_mut().push_unrooted(
+ for attr in node_elem.deref().attrs.borrow().iter().map(|attr| attr.root()) {
+ copy_elem.deref().attrs.borrow_mut().push_unrooted(
&Attr::new(&*window,
attr.deref().local_name.clone(), attr.deref().value.clone(),
attr.deref().name.clone(), attr.deref().namespace.clone(),
- attr.deref().prefix.clone(), &copy_elem_alias));
+ attr.deref().prefix.clone(), copy_elem));
}
},
_ => ()