aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorTom Schuster <evilpies@gmail.com>2014-11-07 14:36:57 +0100
committerTom Schuster <evilpies@gmail.com>2014-11-07 14:36:57 +0100
commit96e42feaa1e43b641ae1d5f19d6de9d62f0a96ac (patch)
tree3c42ec7a420dbbe7b1e96dd550435fc032a453c0 /components/script
parent23b75816a2fafe9004c2def038f0c0fe774cc1a8 (diff)
downloadservo-96e42feaa1e43b641ae1d5f19d6de9d62f0a96ac.tar.gz
servo-96e42feaa1e43b641ae1d5f19d6de9d62f0a96ac.zip
Implement the whole Attr interface
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/attr.rs16
-rw-r--r--components/script/dom/webidls/Attr.webidl10
2 files changed, 23 insertions, 3 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index bbb7325a7ae..324d17d6e14 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -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> {
diff --git a/components/script/dom/webidls/Attr.webidl b/components/script/dom/webidls/Attr.webidl
index 2b3d18150d8..3c7478c3851 100644
--- a/components/script/dom/webidls/Attr.webidl
+++ b/components/script/dom/webidls/Attr.webidl
@@ -9,10 +9,14 @@
*/
interface Attr {
+ 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 DOMString name;
- readonly attribute DOMString? namespaceURI;
- readonly attribute DOMString? prefix;
+ readonly attribute Element? ownerElement;
+
+ readonly attribute boolean specified; // useless; always returns true
};