Make Document::root private, in preparation for removing it as part of making Document a Node.

This commit is contained in:
Ms2ger 2013-10-13 14:08:37 +02:00
parent fc9fdf30a6
commit b6b2606c96
4 changed files with 17 additions and 22 deletions

View file

@ -62,18 +62,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)
})
}
}