diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-12-04 09:43:40 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-12-04 09:43:40 +0100 |
commit | 41395412eb724db393ff546cb232b5ffd5a651a4 (patch) | |
tree | 8c9ebc5b505d1ae44f0aad882d1e5d448c92c148 /components/script/dom/document.rs | |
parent | 90b0369cdfbd62b6c6fa745beffdfd206c825543 (diff) | |
download | servo-41395412eb724db393ff546cb232b5ffd5a651a4.tar.gz servo-41395412eb724db393ff546cb232b5ffd5a651a4.zip |
Cleanup Document::GetDoctype.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index c3c71cb5101..e5ecf461a6c 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -520,12 +520,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { // http://dom.spec.whatwg.org/#dom-document-doctype fn GetDoctype(self) -> Option<Temporary<DocumentType>> { let node: JSRef<Node> = NodeCast::from_ref(self); - node.children().find(|child| { - child.is_doctype() - }).map(|node| { - let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap(); - Temporary::from_rooted(doctype) - }) + node.children() + .filter_map(DocumentTypeCast::to_ref) + .next() + .map(Temporary::from_rooted) } // http://dom.spec.whatwg.org/#dom-document-documentelement |