mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Make DOMTokenList.contains not throw anymore
This commit is contained in:
parent
51d41c5161
commit
66b0568bb3
5 changed files with 9 additions and 70 deletions
|
@ -70,15 +70,14 @@ impl DOMTokenListMethods for DOMTokenList {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
||||
fn Contains(&self, token: DOMString) -> Fallible<bool> {
|
||||
self.check_token_exceptions(&token).map(|token| {
|
||||
self.attribute().map_or(false, |attr| {
|
||||
let attr = attr.r();
|
||||
attr.value()
|
||||
.as_tokens()
|
||||
.iter()
|
||||
.any(|atom: &Atom| *atom == token)
|
||||
})
|
||||
fn Contains(&self, token: DOMString) -> bool {
|
||||
let token = Atom::from(token);
|
||||
self.attribute().map_or(false, |attr| {
|
||||
let attr = attr.r();
|
||||
attr.value()
|
||||
.as_tokens()
|
||||
.iter()
|
||||
.any(|atom: &Atom| *atom == token)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ interface DOMTokenList {
|
|||
[Pure]
|
||||
getter DOMString? item(unsigned long index);
|
||||
|
||||
[Pure, Throws]
|
||||
[Pure]
|
||||
boolean contains(DOMString token);
|
||||
[Throws]
|
||||
void add(DOMString... tokens);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue