Implement the whole Attr interface

This commit is contained in:
Tom Schuster 2014-11-07 14:36:57 +01:00
parent 23b75816a2
commit 96e42feaa1
4 changed files with 25 additions and 55 deletions

View file

@ -141,6 +141,14 @@ impl<'a> AttrMethods for JSRef<'a, Attr> {
self.set_value(ReplacedAttr, value);
}
fn TextContent(self) -> DOMString {
self.Value()
}
fn SetTextContent(self, value: DOMString) {
self.SetValue(value)
}
fn Name(self) -> DOMString {
self.name.as_slice().to_string()
}
@ -156,6 +164,14 @@ impl<'a> AttrMethods for JSRef<'a, Attr> {
fn GetPrefix(self) -> Option<DOMString> {
self.prefix.clone()
}
fn GetOwnerElement(self) -> Option<Temporary<Element>> {
Some(Temporary::new(self.owner))
}
fn Specified(self) -> bool {
true // Always returns true
}
}
pub trait AttrHelpers<'a> {

View file

@ -9,10 +9,14 @@
*/
interface Attr {
readonly attribute DOMString localName;
attribute DOMString value;
readonly attribute DOMString name;
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString name;
attribute DOMString value;
attribute DOMString textContent; // alias of .value
readonly attribute Element? ownerElement;
readonly attribute boolean specified; // useless; always returns true
};