Privatize Attr

This commit is contained in:
Tim Taubert 2014-10-11 23:25:42 +02:00
parent 9a52bb8310
commit 78fef7eec5
4 changed files with 33 additions and 17 deletions

View file

@ -72,13 +72,14 @@ impl Str for AttrValue {
#[jstraceable]
#[must_root]
#[privatize]
pub struct Attr {
reflector_: Reflector,
local_name: Atom,
value: RefCell<AttrValue>,
pub name: Atom,
pub namespace: Namespace,
pub prefix: Option<DOMString>,
name: Atom,
namespace: Namespace,
prefix: Option<DOMString>,
/// the element that owns this attribute.
owner: JS<Element>,
@ -111,6 +112,21 @@ impl Attr {
reflect_dom_object(box Attr::new_inherited(local_name, value, name, namespace, prefix, owner),
&global::Window(window), AttrBinding::Wrap)
}
#[inline]
pub fn name<'a>(&'a self) -> &'a Atom {
&self.name
}
#[inline]
pub fn namespace<'a>(&'a self) -> &'a Namespace {
&self.namespace
}
#[inline]
pub fn prefix<'a>(&'a self) -> &'a Option<DOMString> {
&self.prefix
}
}
impl<'a> AttrMethods for JSRef<'a, Attr> {