aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/htmldocument.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-10-14 10:22:00 -0700
committerbors-servo <release+servo@mozilla.com>2013-10-14 10:22:00 -0700
commit8d3c7a2ded69f035f8fc98a38dd337237cb7db2a (patch)
treebaa4e3900371913a1a5887741aa6affb86b63a11 /src/components/script/dom/htmldocument.rs
parent90baad3fffcf9b4fc1e1eb88979b7e60291e2eac (diff)
parentb6b2606c96a2e801bece36cb07d0a0f7a8686f93 (diff)
downloadservo-8d3c7a2ded69f035f8fc98a38dd337237cb7db2a.tar.gz
servo-8d3c7a2ded69f035f8fc98a38dd337237cb7db2a.zip
auto merge of #1051 : Ms2ger/servo/private-root, r=jdm
In preparation for removing it as part of making Document a Node.
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r--src/components/script/dom/htmldocument.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs
index c455bd41c7e..32abdd29ed9 100644
--- a/src/components/script/dom/htmldocument.rs
+++ b/src/components/script/dom/htmldocument.rs
@@ -61,18 +61,11 @@ impl HTMLDocument {
}
pub fn GetHead(&self) -> Option<AbstractNode<ScriptView>> {
- match self.parent.root {
+ match self.parent.GetDocumentElement() {
None => None,
- Some(root) => {
- let mut headNode: Option<AbstractNode<ScriptView>> = None;
- let _ = for child in root.traverse_preorder() {
- if child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId) {
- headNode = Some(child);
- break;
- }
- };
- headNode
- }
+ Some(root) => root.traverse_preorder().find(|child| {
+ child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
+ })
}
}