Simplify DOMTokenList::Item.

This commit is contained in:
Ms2ger 2015-11-02 16:04:24 +01:00
parent 13291c4b64
commit d3d1f2b5c4

View file

@ -64,10 +64,7 @@ impl DOMTokenListMethods for DOMTokenList {
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
fn Item(&self, index: u32) -> Option<DOMString> {
self.attribute().and_then(|attr| {
let attr = attr.r();
Some(attr.value().as_tokens()).and_then(|tokens| {
tokens.get(index as usize).map(|token| (**token).to_owned())
})
attr.value().as_tokens().get(index as usize).map(|token| (**token).to_owned())
})
}