aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2013-11-02 18:22:35 +0100
committerMs2ger <ms2ger@gmail.com>2013-11-02 18:22:35 +0100
commit0d56584561ff17830e2e57f2980c1eb7b1d8a449 (patch)
treef5a1639f2497415bc758ef532a841a9c26ff5dcb /src
parent74312da1baff3a5658aabd3d0f2c0be26ae8900b (diff)
downloadservo-0d56584561ff17830e2e57f2980c1eb7b1d8a449.tar.gz
servo-0d56584561ff17830e2e57f2980c1eb7b1d8a449.zip
Introduce HTMLButtonElement::new.
Diffstat (limited to 'src')
-rw-r--r--src/components/script/dom/htmlbuttonelement.rs18
-rw-r--r--src/components/script/html/hubbub_html_parser.rs2
2 files changed, 18 insertions, 2 deletions
diff --git a/src/components/script/dom/htmlbuttonelement.rs b/src/components/script/dom/htmlbuttonelement.rs
index 7710d5a364c..a6b90b9d123 100644
--- a/src/components/script/dom/htmlbuttonelement.rs
+++ b/src/components/script/dom/htmlbuttonelement.rs
@@ -2,9 +2,12 @@
* 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::HTMLButtonElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
+use dom::document::AbstractDocument;
+use dom::element::HTMLButtonElementTypeId;
use dom::htmlelement::HTMLElement;
-use dom::node::{AbstractNode, ScriptView};
+use dom::node::{AbstractNode, Node, ScriptView};
use dom::validitystate::ValidityState;
pub struct HTMLButtonElement {
@@ -12,6 +15,19 @@ pub struct HTMLButtonElement {
}
impl HTMLButtonElement {
+ pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLButtonElement {
+ HTMLButtonElement {
+ htmlelement: HTMLElement::new(HTMLButtonElementTypeId, localName, document)
+ }
+ }
+
+ pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode<ScriptView> {
+ let element = HTMLButtonElement::new_inherited(localName, document);
+ Node::reflect_node(@mut element, document, HTMLButtonElementBinding::Wrap)
+ }
+}
+
+impl HTMLButtonElement {
pub fn Autofocus(&self) -> bool {
false
}
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 61f5b38a2b8..07983994c74 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -215,7 +215,6 @@ pub fn build_element_from_tag(cx: *JSContext, tag: &str, document: AbstractDocum
handle_element!(cx, document, tag, "base", HTMLBaseElementTypeId, HTMLBaseElement, []);
handle_element!(cx, document, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
handle_element!(cx, document, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
- handle_element!(cx, document, tag, "button", HTMLButtonElementTypeId, HTMLButtonElement, []);
handle_htmlelement!(cx, document, tag, "aside", HTMLElementTypeId, HTMLElement);
handle_htmlelement!(cx, document, tag, "b", HTMLElementTypeId, HTMLElement);
@@ -224,6 +223,7 @@ 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, "button", HTMLButtonElement);
handle_newable_element!(document, tag, "canvas", HTMLCanvasElement);
handle_newable_element!(document, tag, "caption", HTMLTableCaptionElement);
handle_newable_element!(document, tag, "col", HTMLTableColElement);