diff options
author | Bruno de Oliveira Abinader <bruno.d@partner.samsung.com> | 2014-01-07 10:15:49 -0400 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno.d@partner.samsung.com> | 2014-01-07 15:51:45 -0400 |
commit | 17b35d52fff79f56b3aa734a1bb3924780e8fb04 (patch) | |
tree | c35a30572cb7abe01fa5ac0d4884e9cfe7134d0b /src/components/script/dom/htmldocument.rs | |
parent | 608ee006abf1c67f438fb8504ec28b4ab08dfde9 (diff) | |
download | servo-17b35d52fff79f56b3aa734a1bb3924780e8fb04.tar.gz servo-17b35d52fff79f56b3aa734a1bb3924780e8fb04.zip |
Implement Document::head()
Implementation details according to the specification below:
http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
This patch is for:
https://github.com/mozilla/servo/issues/1465
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r-- | src/components/script/dom/htmldocument.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs index 8e92a4b41db..57a5c96b7bd 100644 --- a/src/components/script/dom/htmldocument.rs +++ b/src/components/script/dom/htmldocument.rs @@ -34,12 +34,11 @@ impl HTMLDocument { impl HTMLDocument { pub fn GetHead(&self) -> Option<AbstractNode> { - match self.parent.GetDocumentElement() { - None => None, - Some(root) => root.traverse_preorder().find(|child| { + self.parent.GetDocumentElement().and_then(|root| { + root.traverse_preorder().find(|child| { child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId) }) - } + }) } pub fn Images(&self) -> @mut HTMLCollection { |