diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-07-26 03:58:25 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-07-29 00:43:44 +0900 |
commit | f2db7faf19c34165c08f1d5839a7461bc04c20a5 (patch) | |
tree | b964365e1eb9bde7509ee91178ae64f2cc2ca765 /src/components/script/dom/attr.rs | |
parent | 63b0e1568f7de58ba21c9891638154bed1848241 (diff) | |
download | servo-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.rs | 7 |
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(), } } } |