diff options
author | Ms2ger <ms2ger@gmail.com> | 2013-11-01 22:46:44 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2013-11-01 22:46:44 +0100 |
commit | 81018b3dcc35a1ccba66049bd646409ad9f3beab (patch) | |
tree | 20f667442d0744fe9403850a2905637ca88801c0 /src | |
parent | 5a18c616d6a7f99c2813fc9b55b9e5879e90b64d (diff) | |
download | servo-81018b3dcc35a1ccba66049bd646409ad9f3beab.tar.gz servo-81018b3dcc35a1ccba66049bd646409ad9f3beab.zip |
Introduce HTMLMainElement::new.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/htmlmainelement.rs | 17 | ||||
-rw-r--r-- | src/components/script/html/hubbub_html_parser.rs | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/components/script/dom/htmlmainelement.rs b/src/components/script/dom/htmlmainelement.rs index c81d73b2b40..83f48e74e5b 100644 --- a/src/components/script/dom/htmlmainelement.rs +++ b/src/components/script/dom/htmlmainelement.rs @@ -2,8 +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::HTMLMainElementBinding; +use dom::document::AbstractDocument; +use dom::element::HTMLMainElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLMainElement { htmlelement: HTMLElement } + +impl HTMLMainElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLMainElement { + HTMLMainElement { + htmlelement: HTMLElement::new(HTMLMainElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> { + let element = HTMLMainElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLMainElementBinding::Wrap) + } +} diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index b18e7f63903..91dffa0d892 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -237,7 +237,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "link", HTMLLinkElementTypeId, HTMLLinkElement, []); handle_element!(cx, document, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []); handle_element!(cx, document, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []); - handle_element!(cx, document, tag, "main", HTMLMainElementTypeId, HTMLMainElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -259,6 +258,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, "ins", HTMLModElement); + handle_newable_element!(document, tag, "main", HTMLMainElement); handle_newable_element!(document, tag, "meta", HTMLMetaElement); handle_newable_element!(document, tag, "meter", HTMLMeterElement); handle_newable_element!(document, tag, "object", HTMLObjectElement); |