mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store an Atom for Attr::prefix.
This commit is contained in:
parent
5773b0bcdf
commit
89a0c004d5
2 changed files with 5 additions and 5 deletions
|
@ -101,7 +101,7 @@ pub struct Attr {
|
||||||
value: DOMRefCell<AttrValue>,
|
value: DOMRefCell<AttrValue>,
|
||||||
name: Atom,
|
name: Atom,
|
||||||
namespace: Namespace,
|
namespace: Namespace,
|
||||||
prefix: Option<DOMString>,
|
prefix: Option<Atom>,
|
||||||
|
|
||||||
/// the element that owns this attribute.
|
/// the element that owns this attribute.
|
||||||
owner: MutNullableHeap<JS<Element>>,
|
owner: MutNullableHeap<JS<Element>>,
|
||||||
|
@ -116,7 +116,7 @@ impl Attr {
|
||||||
value: DOMRefCell::new(value),
|
value: DOMRefCell::new(value),
|
||||||
name: name,
|
name: name,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix,
|
prefix: prefix.map(|p| Atom::from_slice(&p)),
|
||||||
owner: MutNullableHeap::new(owner.map(JS::from_rooted)),
|
owner: MutNullableHeap::new(owner.map(JS::from_rooted)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ impl Attr {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn prefix<'a>(&'a self) -> &'a Option<DOMString> {
|
pub fn prefix<'a>(&'a self) -> &'a Option<Atom> {
|
||||||
&self.prefix
|
&self.prefix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ impl<'a> AttrMethods for JSRef<'a, Attr> {
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-attr-prefix
|
// https://dom.spec.whatwg.org/#dom-attr-prefix
|
||||||
fn GetPrefix(self) -> Option<DOMString> {
|
fn GetPrefix(self) -> Option<DOMString> {
|
||||||
self.prefix.clone()
|
self.prefix().as_ref().map(|p| (**p).to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-attr-ownerelement
|
// https://dom.spec.whatwg.org/#dom-attr-ownerelement
|
||||||
|
|
|
@ -1778,7 +1778,7 @@ impl Node {
|
||||||
&Attr::new(window.r(),
|
&Attr::new(window.r(),
|
||||||
attr.r().local_name().clone(), attr.r().value().clone(),
|
attr.r().local_name().clone(), attr.r().value().clone(),
|
||||||
attr.r().name().clone(), attr.r().namespace().clone(),
|
attr.r().name().clone(), attr.r().namespace().clone(),
|
||||||
attr.r().prefix().clone(), Some(copy_elem)));
|
attr.r().GetPrefix(), Some(copy_elem)));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue