Skip to content

Commit

Permalink
Add the comment about to use mem::transmute() for values contained …
Browse files Browse the repository at this point in the history
…in DOMRefCell.
  • Loading branch information
tetsuharuohzeki committed Oct 16, 2014
1 parent d54fb04 commit ab90c71
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/script/dom/element.rs
Expand Up @@ -1084,11 +1084,13 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
// This transmute is used to cheat the lifetime restriction.
unsafe { mem::transmute(attr.value().as_slice()) }
})
}
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
self.get_attributes(attr).iter().map(|attr| attr.root()).map(|attr| {
// This transmute is used to cheat the lifetime restriction.
unsafe { mem::transmute(attr.value().as_slice()) }
}).collect()
}
Expand Down

0 comments on commit ab90c71

Please sign in to comment.