aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2013-11-02 18:26:39 +0100
committerMs2ger <ms2ger@gmail.com>2013-11-02 18:26:39 +0100
commit8796ca5c0250c11d6a6ca03c0982b2484179f7bb (patch)
treebd5ff2e5e3fb5bea0bc290ac82c44e7142a49b21
parent0d56584561ff17830e2e57f2980c1eb7b1d8a449 (diff)
downloadservo-8796ca5c0250c11d6a6ca03c0982b2484179f7bb.tar.gz
servo-8796ca5c0250c11d6a6ca03c0982b2484179f7bb.zip
Introduce HTMLBodyElement::new.
-rw-r--r--src/components/script/dom/htmlbodyelement.rs17
-rw-r--r--src/components/script/html/hubbub_html_parser.rs2
2 files changed, 18 insertions, 1 deletions
diff --git a/src/components/script/dom/htmlbodyelement.rs b/src/components/script/dom/htmlbodyelement.rs
index 3f409a23789..2dea5fdcbfa 100644
--- a/src/components/script/dom/htmlbodyelement.rs
+++ b/src/components/script/dom/htmlbodyelement.rs
@@ -2,14 +2,31 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use dom::bindings::codegen::HTMLBodyElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
+use dom::document::AbstractDocument;
+use dom::element::HTMLBodyElementTypeId;
use dom::htmlelement::HTMLElement;
+use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLBodyElement {
htmlelement: HTMLElement
}
impl HTMLBodyElement {
+ pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLBodyElement {
+ HTMLBodyElement {
+ htmlelement: HTMLElement::new(HTMLBodyElementTypeId, localName, document)
+ }
+ }
+
+ pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
+ let element = HTMLBodyElement::new_inherited(localName, document);
+ Node::reflect_node(@mut element, document, HTMLBodyElementBinding::Wrap)
+ }
+}
+
+impl HTMLBodyElement {
pub fn Text(&self) -> DOMString {
None
}
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 07983994c74..593a17ff56f 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -214,7 +214,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
handle_element!(cx, document, tag, "area", HTMLAreaElementTypeId, HTMLAreaElement, []);
handle_element!(cx, document, tag, "base", HTMLBaseElementTypeId, HTMLBaseElement, []);
handle_element!(cx, document, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
- handle_element!(cx, document, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement);
@@ -223,6 +222,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
handle_htmlelement!(cx, document, tag, "small", HTMLElementTypeId, HTMLElement);
handle_newable_element!(document, tag, "audio", HTMLAudioElement);
+ handle_newable_element!(document, tag, "body", HTMLBodyElement);
handle_newable_element!(document, tag, "button", HTMLButtonElement);
handle_newable_element!(document, tag, "canvas", HTMLCanvasElement);
handle_newable_element!(document, tag, "caption", HTMLTableCaptionElement);