mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
renaming tokens(), atom() and uint() and rewriting to return or panic
This commit is contained in:
parent
eaf90c0b1c
commit
105ea0d690
8 changed files with 31 additions and 35 deletions
|
@ -61,7 +61,7 @@ impl DOMTokenListMethods for DOMTokenList {
|
|||
fn Length(&self) -> u32 {
|
||||
self.attribute().map(|attr| {
|
||||
let attr = attr.r();
|
||||
attr.value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
||||
attr.value().as_tokens().len()
|
||||
}).unwrap_or(0) as u32
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl DOMTokenListMethods for DOMTokenList {
|
|||
fn Item(&self, index: u32) -> Option<DOMString> {
|
||||
self.attribute().and_then(|attr| {
|
||||
let attr = attr.r();
|
||||
attr.value().tokens().and_then(|tokens| {
|
||||
Some(attr.value().as_tokens()).and_then(|tokens| {
|
||||
tokens.get(index as usize).map(|token| (**token).to_owned())
|
||||
})
|
||||
})
|
||||
|
@ -81,10 +81,9 @@ impl DOMTokenListMethods for DOMTokenList {
|
|||
self.attribute().map(|attr| {
|
||||
let attr = attr.r();
|
||||
attr.value()
|
||||
.tokens()
|
||||
.expect("Should have parsed this attribute")
|
||||
.as_tokens()
|
||||
.iter()
|
||||
.any(|atom| *atom == token)
|
||||
.any(|atom: &Atom| *atom == token)
|
||||
}).unwrap_or(false)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue