diff options
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index e38b0ee82c2..ff7e4e1e925 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -42,6 +42,7 @@ use std::cell::{Cell, RefCell}; use std::mem; #[deriving(Encodable)] +#[must_root] pub struct Element { pub node: Node, pub local_name: Atom, @@ -160,8 +161,8 @@ impl Element { } pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: &JSRef<Document>) -> Temporary<Element> { - let element = Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document); - Node::reflect_node(box element, document, ElementBinding::Wrap) + Node::reflect_node(box Element::new_inherited(ElementTypeId, local_name, namespace, prefix, document), + document, ElementBinding::Wrap) } } @@ -173,6 +174,7 @@ pub trait RawLayoutElementHelpers { impl RawLayoutElementHelpers for Element { #[inline] + #[allow(unrooted_must_root)] unsafe fn get_attr_val_for_layout(&self, namespace: &Namespace, name: &str) -> Option<&'static str> { // cast to point to T in RefCell<T> directly @@ -188,6 +190,7 @@ impl RawLayoutElementHelpers for Element { } #[inline] + #[allow(unrooted_must_root)] unsafe fn get_attr_atom_for_layout(&self, namespace: &Namespace, name: &str) -> Option<Atom> { // cast to point to T in RefCell<T> directly @@ -203,6 +206,7 @@ impl RawLayoutElementHelpers for Element { } #[inline] + #[allow(unrooted_must_root)] unsafe fn has_class_for_layout(&self, name: &str) -> bool { let attrs: *const Vec<JS<Attr>> = mem::transmute(&self.attrs); (*attrs).iter().find(|attr: & &JS<Attr>| { |