aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/script/dom/htmltemplateelement.rs14
-rw-r--r--src/components/script/html/hubbub_html_parser.rs2
2 files changed, 15 insertions, 1 deletions
diff --git a/src/components/script/dom/htmltemplateelement.rs b/src/components/script/dom/htmltemplateelement.rs
index 11e4e399948..8ccea37c420 100644
--- a/src/components/script/dom/htmltemplateelement.rs
+++ b/src/components/script/dom/htmltemplateelement.rs
@@ -2,11 +2,25 @@
* 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::HTMLTemplateElementBinding;
+use dom::document::AbstractDocument;
+use dom::element::HTMLTemplateElementTypeId;
use dom::htmlelement::HTMLElement;
+use dom::node::{AbstractNode, Node, ScriptView};
pub struct HTMLTemplateElement {
htmlelement: HTMLElement,
}
impl HTMLTemplateElement {
+ pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTemplateElement {
+ HTMLTemplateElement {
+ htmlelement: HTMLElement::new(HTMLTemplateElementTypeId, localName, document)
+ }
+ }
+
+ pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
+ let element = HTMLTemplateElement::new_inherited(localName, document);
+ Node::reflect_node(@mut element, document, HTMLTemplateElementBinding::Wrap)
+ }
}
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 2c54b020289..42826b1dd4d 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -262,7 +262,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
handle_element!(cx, document, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, document, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
- handle_element!(cx, document, tag, "template",HTMLTemplateElementTypeId, HTMLTemplateElement, []);
handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement);
@@ -280,6 +279,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
handle_newable_element!(document, tag, "iframe", HTMLIFrameElement);
handle_newable_element!(document, tag, "img", HTMLImageElement);
handle_newable_element!(document, tag, "td", HTMLTableDataCellElement);
+ handle_newable_element!(document, tag, "template", HTMLTemplateElement);
handle_newable_element!(document, tag, "textarea", HTMLTextAreaElement);
handle_newable_element!(document, tag, "th", HTMLTableHeaderCellElement);
handle_newable_element!(document, tag, "time", HTMLTimeElement);