mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Added AttrValue::from_atomic_tokens & Element::set_atomic_tokenlist_attribute
This commit is contained in:
parent
c5f7e553e4
commit
8859286a99
2 changed files with 14 additions and 0 deletions
|
@ -656,6 +656,7 @@ pub trait AttributeHandlers {
|
|||
fn get_string_attribute(self, name: &Atom) -> DOMString;
|
||||
fn set_string_attribute(self, name: &Atom, value: DOMString);
|
||||
fn set_tokenlist_attribute(self, name: &Atom, value: DOMString);
|
||||
fn set_atomic_tokenlist_attribute(self, name: &Atom, tokens: Vec<Atom>);
|
||||
fn get_uint_attribute(self, name: &Atom) -> u32;
|
||||
fn set_uint_attribute(self, name: &Atom, value: u32);
|
||||
}
|
||||
|
@ -851,6 +852,11 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
self.set_attribute(name, AttrValue::from_serialized_tokenlist(value));
|
||||
}
|
||||
|
||||
fn set_atomic_tokenlist_attribute(self, name: &Atom, tokens: Vec<Atom>) {
|
||||
assert!(name.as_slice() == name.as_slice().to_ascii_lower().as_slice());
|
||||
self.set_attribute(name, AttrValue::from_atomic_tokens(tokens));
|
||||
}
|
||||
|
||||
fn get_uint_attribute(self, name: &Atom) -> u32 {
|
||||
assert!(name.as_slice().chars().all(|ch| {
|
||||
!ch.is_ascii() || ch.to_ascii().to_lowercase() == ch.to_ascii()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue