mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +00:00
Generate bindings for HTMLTimeElement
This commit is contained in:
parent
c0935cba72
commit
57f3ce8f81
10 changed files with 57 additions and 5 deletions
|
@ -568,6 +568,7 @@ addHTMLElement('HTMLTableElement')
|
|||
addHTMLElement('HTMLTableRowElement')
|
||||
addHTMLElement('HTMLTableSectionElement')
|
||||
addHTMLElement('HTMLTextAreaElement')
|
||||
addHTMLElement('HTMLTimeElement')
|
||||
addHTMLElement('HTMLTitleElement')
|
||||
addHTMLElement('HTMLUListElement')
|
||||
|
||||
|
|
|
@ -4636,6 +4636,7 @@ class CGBindingRoot(CGThing):
|
|||
'dom::htmltablerowelement::HTMLTableRowElement',
|
||||
'dom::htmltablesectionelement::HTMLTableSectionElement',
|
||||
'dom::htmltextareaelement::HTMLTextAreaElement',
|
||||
'dom::htmltimeelement::HTMLTimeElement',
|
||||
'dom::htmltitleelement::HTMLTitleElement', #XXXyusukesuzuki
|
||||
'dom::htmlulistelement::HTMLUListElement',
|
||||
'dom::bindings::utils::*',
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* -*- 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/multipage/text-level-semantics.html#the-time-element
|
||||
*/
|
||||
|
||||
interface HTMLTimeElement : HTMLElement {
|
||||
[SetterThrows]
|
||||
attribute DOMString dateTime;
|
||||
};
|
|
@ -15,7 +15,7 @@ use dom::element::{HTMLElementTypeId,
|
|||
HTMLParagraphElementTypeId, HTMLScriptElementTypeId,
|
||||
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
|
||||
HTMLTableCaptionElementTypeId, HTMLTableElementTypeId,
|
||||
HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId,
|
||||
HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId, HTMLTimeElementTypeId,
|
||||
HTMLTitleElementTypeId, HTMLUListElementTypeId, HTMLDListElementTypeId};
|
||||
use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagraphElement, HTMLSpanElement};
|
||||
use dom::htmlelement::HTMLElement;
|
||||
|
@ -36,6 +36,7 @@ use dom::htmltableelement::HTMLTableElement;
|
|||
use dom::htmltablerowelement::HTMLTableRowElement;
|
||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
||||
use dom::htmltimeelement::HTMLTimeElement;
|
||||
use dom::htmltitleelement::HTMLTitleElement;
|
||||
use dom::htmlulistelement::HTMLUListElement;
|
||||
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
|
||||
|
@ -125,6 +126,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
|||
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
|
||||
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),
|
||||
ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement),
|
||||
ElementNodeTypeId(HTMLTimeElementTypeId) => generate_element!(HTMLTimeElement),
|
||||
ElementNodeTypeId(HTMLTitleElementTypeId) => generate_element!(HTMLTitleElement),
|
||||
ElementNodeTypeId(HTMLUListElementTypeId) => generate_element!(HTMLUListElement),
|
||||
ElementNodeTypeId(_) => element::create(cx, node).ptr,
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLBodyElementBinding, H
|
|||
HTMLStyleElementBinding, HTMLTableCaptionElementBinding,
|
||||
HTMLTableElementBinding, HTMLTableRowElementBinding,
|
||||
HTMLTableSectionElementBinding, HTMLTextAreaElementBinding,
|
||||
HTMLTitleElementBinding, HTMLUListElementBinding};
|
||||
HTMLTimeElementBinding, HTMLTitleElementBinding, HTMLUListElementBinding};
|
||||
use dom::bindings::utils::{null_string, str};
|
||||
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
|
||||
use dom::clientrect::ClientRect;
|
||||
|
@ -36,10 +36,11 @@ use dom::htmlstyleelement::HTMLStyleElement;
|
|||
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
||||
use dom::htmltableelement::HTMLTableElement;
|
||||
use dom::htmltablerowelement::HTMLTableRowElement;
|
||||
use dom::htmlulistelement::HTMLUListElement;
|
||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
||||
use dom::htmltimeelement::HTMLTimeElement;
|
||||
use dom::htmltitleelement::HTMLTitleElement;
|
||||
use dom::htmlulistelement::HTMLUListElement;
|
||||
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
|
||||
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
|
||||
use layout_interface::{ContentBoxesResponse};
|
||||
|
@ -110,6 +111,7 @@ pub enum ElementTypeId {
|
|||
HTMLTableRowElementTypeId,
|
||||
HTMLTableSectionElementTypeId,
|
||||
HTMLTextAreaElementTypeId,
|
||||
HTMLTimeElementTypeId,
|
||||
HTMLTitleElementTypeId,
|
||||
HTMLUListElementTypeId,
|
||||
UnknownElementTypeId,
|
||||
|
@ -233,6 +235,8 @@ generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wra
|
|||
generate_binding_object!(HTMLTextAreaElement)
|
||||
generate_cacheable_wrapper!(HTMLTitleElement, HTMLTitleElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLTitleElement)
|
||||
generate_cacheable_wrapper!(HTMLTimeElement, HTMLTimeElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLTimeElement)
|
||||
generate_cacheable_wrapper!(HTMLUListElement, HTMLUListElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLUListElement)
|
||||
|
||||
|
|
19
src/components/script/dom/htmltimeelement.rs
Normal file
19
src/components/script/dom/htmltimeelement.rs
Normal 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 HTMLTimeElement {
|
||||
parent: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLTimeElement {
|
||||
pub fn DateTime(&self) -> DOMString {
|
||||
null_string
|
||||
}
|
||||
|
||||
pub fn SetDateTime(&mut self, _dateTime: &DOMString, _rv: &mut ErrorResult) {
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ use dom::element::{HTMLElementTypeId,
|
|||
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
|
||||
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
|
||||
HTMLTableCaptionElementTypeId, HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
|
||||
HTMLTitleElementTypeId, HTMLUListElementTypeId,
|
||||
HTMLTimeElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId,
|
||||
UnknownElementTypeId};
|
||||
use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
|
||||
HTMLHeadElement, HTMLHeadingElement, HTMLHtmlElement,
|
||||
|
@ -43,6 +43,7 @@ use dom::htmltableelement::HTMLTableElement;
|
|||
use dom::htmltablerowelement::HTMLTableRowElement;
|
||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
||||
use dom::htmltimeelement::HTMLTimeElement;
|
||||
use dom::htmltitleelement::HTMLTitleElement;
|
||||
use dom::htmlulistelement::HTMLUListElement;
|
||||
use dom::element::Element;
|
||||
|
@ -253,8 +254,9 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
|||
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, "time", HTMLTimeElementTypeId, HTMLTimeElement, []);
|
||||
handle_element!(cx, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []);
|
||||
handle_element!(cx, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []);
|
||||
handle_element!(cx, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []);
|
||||
|
||||
handle_element!(cx, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]);
|
||||
|
|
|
@ -67,6 +67,7 @@ pub mod dom {
|
|||
pub mod HTMLTableRowElementBinding;
|
||||
pub mod HTMLTableSectionElementBinding;
|
||||
pub mod HTMLTextAreaElementBinding;
|
||||
pub mod HTMLTimeElementBinding;
|
||||
pub mod HTMLTitleElementBinding;
|
||||
pub mod HTMLUListElementBinding;
|
||||
pub mod MouseEventBinding;
|
||||
|
@ -109,6 +110,7 @@ pub mod dom {
|
|||
pub mod htmltablerowelement;
|
||||
pub mod htmltablesectionelement;
|
||||
pub mod htmltextareaelement;
|
||||
pub mod htmltimeelement;
|
||||
pub mod htmltitleelement;
|
||||
pub mod htmlulistelement;
|
||||
pub mod mouseevent;
|
||||
|
|
|
@ -32,5 +32,6 @@
|
|||
<b>b</b>
|
||||
<i>i</i>
|
||||
<textarea>textarea</textarea>
|
||||
<time datetime="2014-02-14">Valentines day</time>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -158,6 +158,13 @@ window.alert(tags.length);
|
|||
window.alert(tags[0].tagName);
|
||||
window.alert(tags[0] instanceof HTMLCanvasElement);
|
||||
|
||||
window.alert("HTMLTimeElement:");
|
||||
let tags = document.getElementsByTagName("time");
|
||||
window.alert(tags);
|
||||
window.alert(tags.length);
|
||||
window.alert(tags[0].tagName);
|
||||
window.alert(tags[0] instanceof HTMLTimeElement);
|
||||
|
||||
window.alert("HTMLTableCaptionElement:");
|
||||
let tags = document.getElementsByTagName("caption");
|
||||
window.alert(tags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue