aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/attr.rs
diff options
context:
space:
mode:
authorTetsuharu OHZEKI <saneyuki.snyk@gmail.com>2014-07-26 03:58:25 +0900
committerTetsuharu OHZEKI <saneyuki.snyk@gmail.com>2014-07-29 00:43:44 +0900
commitf2db7faf19c34165c08f1d5839a7461bc04c20a5 (patch)
treeb964365e1eb9bde7509ee91178ae64f2cc2ca765 /src/components/script/dom/attr.rs
parent63b0e1568f7de58ba21c9891638154bed1848241 (diff)
downloadservo-f2db7faf19c34165c08f1d5839a7461bc04c20a5.tar.gz
servo-f2db7faf19c34165c08f1d5839a7461bc04c20a5.zip
Port `id` attribute to use atom.
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(),
}
}
}