mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Cleanup Document::GetDoctype.
This commit is contained in:
parent
90b0369cdf
commit
41395412eb
1 changed files with 4 additions and 6 deletions
|
@ -520,12 +520,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
// http://dom.spec.whatwg.org/#dom-document-doctype
|
// http://dom.spec.whatwg.org/#dom-document-doctype
|
||||||
fn GetDoctype(self) -> Option<Temporary<DocumentType>> {
|
fn GetDoctype(self) -> Option<Temporary<DocumentType>> {
|
||||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||||
node.children().find(|child| {
|
node.children()
|
||||||
child.is_doctype()
|
.filter_map(DocumentTypeCast::to_ref)
|
||||||
}).map(|node| {
|
.next()
|
||||||
let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(node).unwrap();
|
.map(Temporary::from_rooted)
|
||||||
Temporary::from_rooted(doctype)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-documentelement
|
// http://dom.spec.whatwg.org/#dom-document-documentelement
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue