Add a getter of 'document.head' according to HTML spec.

Add a getter and a setter of 'document.title' according to HTML spec.
Modify the test file.
This commit is contained in:
Junyoung Cho 2013-07-31 17:32:23 +09:00
parent b84552b89d
commit 00c3ffb7a4
5 changed files with 95 additions and 11 deletions

View file

@ -6,9 +6,9 @@ use dom::bindings::codegen::HTMLDocumentBinding;
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache};
use dom::document::{AbstractDocument, Document, WrappableDocument, HTML};
use dom::element::Element;
use dom::element::{Element, HTMLHeadElementTypeId};
use dom::htmlcollection::HTMLCollection;
use dom::node::{AbstractNode, ScriptView};
use dom::node::{AbstractNode, ScriptView, ElementNodeTypeId};
use dom::window::Window;
use js::jsapi::{JSObject, JSContext};
@ -68,7 +68,14 @@ impl HTMLDocument {
}
pub fn GetHead(&self) -> Option<AbstractNode<ScriptView>> {
None
let mut headNode: Option<AbstractNode<ScriptView>> = None;
let _ = for self.parent.root.traverse_preorder |child| {
if child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId) {
headNode = Some(child);
break;
}
};
headNode
}
pub fn Images(&self) -> @mut HTMLCollection {