aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/htmldocument.rs
diff options
context:
space:
mode:
authorJunyoung Cho <june0.cho@samsung.com>2013-07-31 17:32:23 +0900
committerJunyoung Cho <june0.cho@samsung.com>2013-08-08 09:42:56 +0900
commit00c3ffb7a4ec3cef22b2b30e0a00b5e69988619d (patch)
treeb04b9561b338c98a97bc476a3e7915420a8897ac /src/components/script/dom/htmldocument.rs
parentb84552b89d29160240443e51a776d827df2116d0 (diff)
downloadservo-00c3ffb7a4ec3cef22b2b30e0a00b5e69988619d.tar.gz
servo-00c3ffb7a4ec3cef22b2b30e0a00b5e69988619d.zip
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.
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r--src/components/script/dom/htmldocument.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs
index 619390352f8..a102fd8aa81 100644
--- a/src/components/script/dom/htmldocument.rs
+++ b/src/components/script/dom/htmldocument.rs
@@ -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 {