aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/domtokenlist.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/domtokenlist.rs')
-rw-r--r--components/script/dom/domtokenlist.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index dd7eb17ba74..fd1644f17c7 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -54,10 +54,10 @@ impl DOMTokenList {
impl DOMTokenListMethods for DOMTokenList {
// https://dom.spec.whatwg.org/#dom-domtokenlist-length
fn Length(&self) -> u32 {
- self.attribute().map(|attr| {
+ self.attribute().map_or(0, |attr| {
let attr = attr.r();
attr.value().as_tokens().len()
- }).unwrap_or(0) as u32
+ }) as u32
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
@@ -71,13 +71,13 @@ 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(|attr| {
+ self.attribute().map_or(false, |attr| {
let attr = attr.r();
attr.value()
.as_tokens()
.iter()
.any(|atom: &Atom| *atom == token)
- }).unwrap_or(false)
+ })
})
}