mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add the comment about to use mem::transmute()
for values contained in DOMRefCell.
This commit is contained in:
parent
d54fb041ba
commit
ab90c718eb
1 changed files with 2 additions and 0 deletions
|
@ -1084,11 +1084,13 @@ impl<'a> VirtualMethods for JSRef<'a, Element> {
|
||||||
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
|
impl<'a> style::TElement<'a> for JSRef<'a, Element> {
|
||||||
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
|
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
|
||||||
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
|
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()) }
|
unsafe { mem::transmute(attr.value().as_slice()) }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
|
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
|
||||||
self.get_attributes(attr).iter().map(|attr| attr.root()).map(|attr| {
|
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()) }
|
unsafe { mem::transmute(attr.value().as_slice()) }
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue