From 5bfc044ee47bc8baf9df69d9d2827739523f8427 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 2 Nov 2013 11:41:51 +0100 Subject: [PATCH] Introduce HTMLHRElement::new. --- src/components/script/dom/htmlhrelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/htmlhrelement.rs b/src/components/script/dom/htmlhrelement.rs index 73d0094a4fb..677b86dc796 100644 --- a/src/components/script/dom/htmlhrelement.rs +++ b/src/components/script/dom/htmlhrelement.rs @@ -2,13 +2,30 @@ * 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::HTMLHRElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLHRElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLHRElement { htmlelement: HTMLElement, } +impl HTMLHRElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLHRElement { + HTMLHRElement { + htmlelement: HTMLElement::new(HTMLHRElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLHRElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLHRElementBinding::Wrap) + } +} + impl HTMLHRElement { pub fn Align(&self) -> DOMString { None diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index ed25bc24842..444971d83cd 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -228,7 +228,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "form", HTMLFormElementTypeId, HTMLFormElement, []); handle_element!(cx, document, tag, "frame", HTMLFrameElementTypeId, HTMLFrameElement, []); handle_element!(cx, document, tag, "frameset",HTMLFrameSetElementTypeId, HTMLFrameSetElement, []); - handle_element!(cx, document, tag, "hr", HTMLHRElementTypeId, HTMLHRElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -248,6 +247,7 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_newable_element!(document, tag, "h5", HTMLHeadingElement, Heading5); handle_newable_element!(document, tag, "h6", HTMLHeadingElement, Heading6); handle_newable_element!(document, tag, "head", HTMLHeadElement); + handle_newable_element!(document, tag, "hr", HTMLHRElement); handle_newable_element!(document, tag, "html", HTMLHtmlElement); handle_newable_element!(document, tag, "iframe", HTMLIFrameElement); handle_newable_element!(document, tag, "img", HTMLImageElement);