mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #5525 - dhodder:master, r=jdm
An empty DOM interface for HTMLDialogElement r?
This commit is contained in:
commit
1fd609d198
9 changed files with 59 additions and 9 deletions
|
@ -18,6 +18,7 @@ use dom::htmlbuttonelement::HTMLButtonElement;
|
|||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use dom::htmldataelement::HTMLDataElement;
|
||||
use dom::htmldatalistelement::HTMLDataListElement;
|
||||
use dom::htmldialogelement::HTMLDialogElement;
|
||||
use dom::htmldirectoryelement::HTMLDirectoryElement;
|
||||
use dom::htmldivelement::HTMLDivElement;
|
||||
use dom::htmldlistelement::HTMLDListElement;
|
||||
|
@ -134,6 +135,7 @@ pub fn create_element(name: QualName, prefix: Option<DOMString>,
|
|||
atom!("del") => make!(HTMLModElement),
|
||||
atom!("details") => make!(HTMLElement),
|
||||
atom!("dfn") => make!(HTMLElement),
|
||||
atom!("dialog") => make!(HTMLDialogElement),
|
||||
atom!("dir") => make!(HTMLDirectoryElement),
|
||||
atom!("div") => make!(HTMLDivElement),
|
||||
atom!("dl") => make!(HTMLDListElement),
|
||||
|
|
39
components/script/dom/htmldialogelement.rs
Normal file
39
components/script/dom/htmldialogelement.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* 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::codegen::Bindings::HTMLDialogElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLDialogElementDerived;
|
||||
use dom::bindings::js::{JSRef, Temporary};
|
||||
use dom::document::Document;
|
||||
use dom::element::ElementTypeId;
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLDialogElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
||||
impl HTMLDialogElementDerived for EventTarget {
|
||||
fn is_htmldialogelement(&self) -> bool {
|
||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement)))
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLDialogElement {
|
||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDialogElement {
|
||||
HTMLDialogElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDialogElement> {
|
||||
let element = HTMLDialogElement::new_inherited(localName, prefix, document);
|
||||
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
|
@ -253,6 +253,7 @@ pub enum HTMLElementTypeId {
|
|||
HTMLCanvasElement,
|
||||
HTMLDataElement,
|
||||
HTMLDataListElement,
|
||||
HTMLDialogElement,
|
||||
HTMLDirectoryElement,
|
||||
HTMLDListElement,
|
||||
HTMLDivElement,
|
||||
|
|
|
@ -236,6 +236,7 @@ pub mod htmlcanvaselement;
|
|||
pub mod htmlcollection;
|
||||
pub mod htmldataelement;
|
||||
pub mod htmldatalistelement;
|
||||
pub mod htmldialogelement;
|
||||
pub mod htmldirectoryelement;
|
||||
pub mod htmldivelement;
|
||||
pub mod htmldlistelement;
|
||||
|
|
13
components/script/dom/webidls/HTMLDialogElement.webidl
Normal file
13
components/script/dom/webidls/HTMLDialogElement.webidl
Normal file
|
@ -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/. */
|
||||
|
||||
// http://www.whatwg.org/html/#htmldialogelement
|
||||
interface HTMLDialogElement : HTMLElement {
|
||||
//attribute boolean open;
|
||||
//attribute DOMString returnValue;
|
||||
//void show(optional (MouseEvent or Element) anchor);
|
||||
//void showModal(optional (MouseEvent or Element) anchor);
|
||||
//void close(optional DOMString returnValue);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue