aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-04 08:34:05 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-06-04 08:34:05 -0500
commitec869eff19c7012b01db79d6522270a94ddb27d8 (patch)
treef433b0fcd576089985a3cf29c9fa94494c69b956 /components/script/dom
parent6581e3504a60aa1e7c363cc93b1036b4a174c166 (diff)
parent66b0568bb37c3ac016e38926a540e3ead5eba22c (diff)
downloadservo-ec869eff19c7012b01db79d6522270a94ddb27d8.tar.gz
servo-ec869eff19c7012b01db79d6522270a94ddb27d8.zip
Auto merge of #11589 - GuillaumeGomez:contains, r=nox
Make DOMTokenList.contains not throw anymore Fixes #11579. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11589) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/domtokenlist.rs17
-rw-r--r--components/script/dom/webidls/DOMTokenList.webidl2
2 files changed, 9 insertions, 10 deletions
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index dabf3bf4cb9..1fb53e6ce06 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -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)
})
}
diff --git a/components/script/dom/webidls/DOMTokenList.webidl b/components/script/dom/webidls/DOMTokenList.webidl
index 1b50c34c918..2b7da5dea74 100644
--- a/components/script/dom/webidls/DOMTokenList.webidl
+++ b/components/script/dom/webidls/DOMTokenList.webidl
@@ -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);