Skip to content

Commit

Permalink
Make DOMTokenList.contains not throw anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 4, 2016
1 parent 51d41c5 commit 66b0568
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 70 deletions.
17 changes: 8 additions & 9 deletions components/script/dom/domtokenlist.rs
Expand Up @@ -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)
})
}

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/DOMTokenList.webidl
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions tests/wpt/metadata/dom/nodes/Element-classlist.html.ini

This file was deleted.

6 changes: 0 additions & 6 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -6286,12 +6286,6 @@
"url": "/_mozilla/mozilla/document_url.html"
}
],
"mozilla/domtokenlist.html": [
{
"path": "mozilla/domtokenlist.html",
"url": "/_mozilla/mozilla/domtokenlist.html"
}
],
"mozilla/element_attribute.html": [
{
"path": "mozilla/element_attribute.html",
Expand Down
46 changes: 0 additions & 46 deletions tests/wpt/mozilla/tests/mozilla/domtokenlist.html

This file was deleted.

0 comments on commit 66b0568

Please sign in to comment.