diff options
-rw-r--r-- | components/script/dom/domtokenlist.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index a7326fa8e2d..d05606965b2 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -90,10 +90,13 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> { // http://dom.spec.whatwg.org/#dom-domtokenlist-contains fn Contains(self, token: DOMString) -> Fallible<bool> { self.check_token_exceptions(token.as_slice()).map(|slice| { - self.attribute().root().and_then(|attr| attr.value().tokens().map(|tokens| { + self.attribute().root().map(|attr| { + let value = attr.value(); + let tokens = value.tokens() + .expect("Should have parsed this attribute"); let atom = Atom::from_slice(slice); tokens.iter().any(|token| *token == atom) - })).unwrap_or(false) + }).unwrap_or(false) }) } } |