Generate bindings for HTMLTableCaptionElement

This commit is contained in:
Youngsoo Son 2013-08-12 13:20:41 +09:00 committed by Josh Matthews
parent 1c087ab507
commit c0935cba72
10 changed files with 65 additions and 5 deletions

View file

@ -563,6 +563,7 @@ addHTMLElement('HTMLParagraphElement')
addHTMLElement('HTMLScriptElement')
addHTMLElement('HTMLSpanElement')
addHTMLElement('HTMLStyleElement')
addHTMLElement('HTMLTableCaptionElement')
addHTMLElement('HTMLTableElement')
addHTMLElement('HTMLTableRowElement')
addHTMLElement('HTMLTableSectionElement')

View file

@ -4631,6 +4631,7 @@ class CGBindingRoot(CGThing):
'dom::htmlolistelement::HTMLOListElement',
'dom::htmlscriptelement::HTMLScriptElement',
'dom::htmlstyleelement::HTMLStyleElement',
'dom::htmltablecaptionelement::HTMLTableCaptionElement',
'dom::htmltableelement::HTMLTableElement',
'dom::htmltablerowelement::HTMLTableRowElement',
'dom::htmltablesectionelement::HTMLTableSectionElement',

View file

@ -0,0 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/
*
* ⓒ Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface HTMLTableCaptionElement : HTMLElement {};
partial interface HTMLTableCaptionElement {
[SetterThrows]
attribute DOMString align;
};

View file

@ -14,7 +14,8 @@ use dom::element::{HTMLElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId,
HTMLParagraphElementTypeId, HTMLScriptElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableElementTypeId, HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCaptionElementTypeId, HTMLTableElementTypeId,
HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId,
HTMLTitleElementTypeId, HTMLUListElementTypeId, HTMLDListElementTypeId};
use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagraphElement, HTMLSpanElement};
use dom::htmlelement::HTMLElement;
@ -30,6 +31,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
@ -118,6 +120,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement),
ElementNodeTypeId(HTMLTableCaptionElementTypeId) => generate_element!(HTMLTableCaptionElement),
ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement),
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),

View file

@ -10,7 +10,8 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLBodyElementBinding, H
HTMLHtmlElementBinding, HTMLIFrameElementBinding,
HTMLImageElementBinding, HTMLMetaElementBinding,
HTMLOListElementBinding, HTMLParagraphElementBinding,
HTMLScriptElementBinding, HTMLSpanElementBinding, HTMLStyleElementBinding,
HTMLScriptElementBinding, HTMLSpanElementBinding,
HTMLStyleElementBinding, HTMLTableCaptionElementBinding,
HTMLTableElementBinding, HTMLTableRowElementBinding,
HTMLTableSectionElementBinding, HTMLTextAreaElementBinding,
HTMLTitleElementBinding, HTMLUListElementBinding};
@ -32,6 +33,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmlulistelement::HTMLUListElement;
@ -102,10 +104,11 @@ pub enum ElementTypeId {
HTMLSmallElementTypeId,
HTMLSpanElementTypeId,
HTMLStyleElementTypeId,
HTMLTableSectionElementTypeId,
HTMLTableCaptionElementTypeId,
HTMLTableCellElementTypeId,
HTMLTableElementTypeId,
HTMLTableRowElementTypeId,
HTMLTableSectionElementTypeId,
HTMLTextAreaElementTypeId,
HTMLTitleElementTypeId,
HTMLUListElementTypeId,
@ -219,6 +222,8 @@ generate_binding_object!(HTMLSpanElement)
generate_cacheable_wrapper!(HTMLStyleElement, HTMLStyleElementBinding::Wrap)
generate_binding_object!(HTMLStyleElement)
generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap)
generate_binding_object!(HTMLTableCaptionElement)
generate_cacheable_wrapper!(HTMLTableCaptionElement, HTMLTableCaptionElementBinding::Wrap)
generate_binding_object!(HTMLTableElement)
generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap)
generate_binding_object!(HTMLTableRowElement)

View file

@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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::utils::{DOMString, null_string, ErrorResult};
use dom::htmlelement::HTMLElement;
pub struct HTMLTableCaptionElement {
parent: HTMLElement
}
impl HTMLTableCaptionElement {
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -15,7 +15,7 @@ use dom::element::{HTMLElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableCaptionElementTypeId, HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
HTMLTitleElementTypeId, HTMLUListElementTypeId,
UnknownElementTypeId};
use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
@ -38,6 +38,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
@ -247,9 +248,10 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "small", HTMLSmallElementTypeId, HTMLSmallElement, []);
handle_element!(cx, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []);
handle_element!(cx, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []);
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []);
handle_element!(cx, tag, "td", HTMLTableCellElementTypeId, HTMLTableCellElement, []);
handle_element!(cx, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []);
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []);
handle_element!(cx, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []);
handle_element!(cx, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []);

View file

@ -62,6 +62,7 @@ pub mod dom {
pub mod HTMLScriptElementBinding;
pub mod HTMLSpanElementBinding;
pub mod HTMLStyleElementBinding;
pub mod HTMLTableCaptionElementBinding;
pub mod HTMLTableElementBinding;
pub mod HTMLTableRowElementBinding;
pub mod HTMLTableSectionElementBinding;
@ -103,6 +104,7 @@ pub mod dom {
pub mod htmlolistelement;
pub mod htmlscriptelement;
pub mod htmlstyleelement;
pub mod htmltablecaptionelement;
pub mod htmltableelement;
pub mod htmltablerowelement;
pub mod htmltablesectionelement;

View file

@ -22,6 +22,7 @@
<iframe></iframe>
<ol type="1"></ol>
<table>
<caption>sample table</caption>
<tbody>
<tr></tr>
</tbody>

View file

@ -158,6 +158,13 @@ window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLCanvasElement);
window.alert("HTMLTableCaptionElement:");
let tags = document.getElementsByTagName("caption");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTableCaptionElement);
window.alert("HTMLTextAreaElement:");
let tags = document.getElementsByTagName("textarea");
window.alert(tags);