aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/attr.rs')
-rw-r--r--src/components/script/dom/attr.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/script/dom/attr.rs b/src/components/script/dom/attr.rs
index 2762910171f..f58631176f1 100644
--- a/src/components/script/dom/attr.rs
+++ b/src/components/script/dom/attr.rs
@@ -30,6 +30,7 @@ pub enum AttrValue {
StringAttrValue(DOMString),
TokenListAttrValue(DOMString, Vec<(uint, uint)>),
UIntAttrValue(DOMString, u32),
+ AtomAttrValue(Atom),
}
impl AttrValue {
@@ -50,11 +51,17 @@ impl AttrValue {
UIntAttrValue(string, result)
}
+ pub fn from_atomic(string: DOMString) -> AttrValue {
+ let value = Atom::from_slice(string.as_slice());
+ AtomAttrValue(value)
+ }
+
pub fn as_slice<'a>(&'a self) -> &'a str {
match *self {
StringAttrValue(ref value) |
TokenListAttrValue(ref value, _) |
UIntAttrValue(ref value, _) => value.as_slice(),
+ AtomAttrValue(ref value) => value.as_slice(),
}
}
}