mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -47,6 +47,14 @@ impl AttrValue {
|
|||
AttrValue::TokenList(tokens, atoms)
|
||||
}
|
||||
|
||||
pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue {
|
||||
let tokens = {
|
||||
let slices: Vec<&str> = atoms.iter().map(|atom| atom.as_slice()).collect();
|
||||
slices.connect("\x20")
|
||||
};
|
||||
AttrValue::TokenList(tokens, atoms)
|
||||
}
|
||||
|
||||
pub fn from_u32(string: DOMString, default: u32) -> AttrValue {
|
||||
let result: u32 = from_str(string.as_slice()).unwrap_or(default);
|
||||
AttrValue::UInt(string, result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue