From e5786422780c6e622849b16df1f7acba8660e0cd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 31 Oct 2013 19:20:37 +0100 Subject: [PATCH] Introduce HTMLTableColElement::new. --- .../script/dom/htmltablecolelement.rs | 17 +++++++++++++++++ .../script/html/hubbub_html_parser.rs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/script/dom/htmltablecolelement.rs b/src/components/script/dom/htmltablecolelement.rs index 78ad9867e0e..27817306a2c 100644 --- a/src/components/script/dom/htmltablecolelement.rs +++ b/src/components/script/dom/htmltablecolelement.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::HTMLTableColElementBinding; use dom::bindings::utils::{DOMString, ErrorResult}; +use dom::document::AbstractDocument; +use dom::element::HTMLTableColElementTypeId; use dom::htmlelement::HTMLElement; +use dom::node::{AbstractNode, Node, ScriptView}; pub struct HTMLTableColElement { htmlelement: HTMLElement, } +impl HTMLTableColElement { + pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLTableColElement { + HTMLTableColElement { + htmlelement: HTMLElement::new(HTMLTableColElementTypeId, localName, document) + } + } + + pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode { + let element = HTMLTableColElement::new_inherited(localName, document); + Node::reflect_node(@mut element, document, HTMLTableColElementBinding::Wrap) + } +} + impl HTMLTableColElement { pub fn Span(&self) -> u32 { 0 diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 93173ceb582..23aea912365 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -259,8 +259,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum handle_element!(cx, document, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); handle_element!(cx, document, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []); handle_element!(cx, document, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []); - handle_element!(cx, document, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []); - handle_element!(cx, document, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []); handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement); @@ -269,6 +267,8 @@ 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, "col", HTMLTableColElement); + handle_newable_element!(document, tag, "colgroup", HTMLTableColElement); handle_newable_element!(document, tag, "h1", HTMLHeadingElement, Heading1); handle_newable_element!(document, tag, "h2", HTMLHeadingElement, Heading2); handle_newable_element!(document, tag, "h3", HTMLHeadingElement, Heading3);