mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Do not copy the result of get_link()
This commit is contained in:
parent
5ae7aad6e2
commit
2782d1d07f
3 changed files with 3 additions and 4 deletions
|
@ -413,7 +413,7 @@ impl<'le> TElement for LayoutElement<'le> {
|
|||
unsafe { self.element.get_attr_val_for_layout(namespace, name) }
|
||||
}
|
||||
|
||||
fn get_link(&self) -> Option<~str> {
|
||||
fn get_link(&self) -> Option<&'static str> {
|
||||
// FIXME: This is HTML only.
|
||||
match self.element.node.type_id {
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
|
||||
|
@ -422,7 +422,6 @@ impl<'le> TElement for LayoutElement<'le> {
|
|||
ElementNodeTypeId(HTMLAreaElementTypeId) |
|
||||
ElementNodeTypeId(HTMLLinkElementTypeId) => {
|
||||
unsafe { self.element.get_attr_val_for_layout(&namespace::Null, "href") }
|
||||
.map(|val| val.to_owned())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) {
|
|||
},
|
||||
URL(value) | String(value) => {
|
||||
if ns.is_some() { syntax_error!() }
|
||||
ns = Some(Namespace::from_str(value.as_slice()));
|
||||
ns = Some(Namespace::from_str(value));
|
||||
break
|
||||
},
|
||||
_ => syntax_error!(),
|
||||
|
|
|
@ -25,7 +25,7 @@ pub trait TNode<E:TElement> : Clone {
|
|||
|
||||
pub trait TElement {
|
||||
fn get_attr(&self, namespace: &Namespace, attr: &str) -> Option<&'static str>;
|
||||
fn get_link(&self) -> Option<~str>;
|
||||
fn get_link(&self) -> Option<&'static str>;
|
||||
fn get_local_name<'a>(&'a self) -> &'a str;
|
||||
fn get_namespace<'a>(&'a self) -> &'a Namespace;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue