diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmlbuttonelement.rs | 10 | ||||
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 15 | ||||
-rw-r--r-- | components/script/dom/htmloptionelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmltablecellelement.rs | 2 |
4 files changed, 7 insertions, 24 deletions
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 7ea783fc68b..85eca4b18bd 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -83,15 +83,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement { } // https://html.spec.whatwg.org/multipage/#dom-button-type - fn Type(&self) -> DOMString { - let mut ty = self.upcast::<Element>().get_string_attribute(&atom!("type")); - ty.make_ascii_lowercase(); - // https://html.spec.whatwg.org/multipage/#attr-button-type - match &*ty { - "reset" | "button" | "menu" => ty, - _ => "submit".to_owned() - } - } + make_enumerated_getter!(Type, "submit", ("reset") | ("button") | ("menu")); // https://html.spec.whatwg.org/multipage/#dom-button-type make_setter!(SetType, "type"); diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 25b93621c02..e3b2fd85111 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -14,7 +14,7 @@ use dom::bindings::global::GlobalRef; use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::refcounted::Trusted; use dom::document::Document; -use dom::element::{AttributeMutation, Element}; +use dom::element::AttributeMutation; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::htmlelement::HTMLElement; use dom::node::{Node, NodeDamage, document_from_node, window_from_node}; @@ -196,11 +196,8 @@ impl HTMLImageElementMethods for HTMLImageElement { // https://html.spec.whatwg.org/multipage/#dom-img-ismap make_bool_getter!(IsMap); - // https://html.spec.whatwg.org/multipage/#dom-img-ismap - fn SetIsMap(&self, is_map: bool) { - self.upcast::<Element>().set_string_attribute(&atom!("ismap"), is_map.to_string()) - } + make_bool_setter!(SetIsMap, "ismap"); // https://html.spec.whatwg.org/multipage/#dom-img-width fn Width(&self) -> u32 { @@ -210,9 +207,7 @@ impl HTMLImageElementMethods for HTMLImageElement { } // https://html.spec.whatwg.org/multipage/#dom-img-width - fn SetWidth(&self, width: u32) { - self.upcast::<Element>().set_uint_attribute(&atom!("width"), width) - } + make_uint_setter!(SetWidth, "width"); // https://html.spec.whatwg.org/multipage/#dom-img-height fn Height(&self) -> u32 { @@ -222,9 +217,7 @@ impl HTMLImageElementMethods for HTMLImageElement { } // https://html.spec.whatwg.org/multipage/#dom-img-height - fn SetHeight(&self, height: u32) { - self.upcast::<Element>().set_uint_attribute(&atom!("height"), height) - } + make_uint_setter!(SetHeight, "height"); // https://html.spec.whatwg.org/multipage/#dom-img-naturalwidth fn NaturalWidth(&self) -> u32 { diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index b06406c4df5..749bbd62b51 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -92,9 +92,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement { make_bool_getter!(Disabled); // https://html.spec.whatwg.org/multipage/#dom-option-disabled - fn SetDisabled(&self, disabled: bool) { - self.upcast::<Element>().set_bool_attribute(&atom!("disabled"), disabled) - } + make_bool_setter!(SetDisabled, "disabled"); // https://html.spec.whatwg.org/multipage/#dom-option-text fn Text(&self) -> DOMString { diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index ac96982a45d..e61aefeb674 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -53,7 +53,7 @@ impl HTMLTableCellElementMethods for HTMLTableCellElement { make_uint_getter!(ColSpan, "colspan", DEFAULT_COLSPAN); // https://html.spec.whatwg.org/multipage/#dom-tdth-colspan - make_uint_setter!(SetColSpan, "colspan"); + make_uint_setter!(SetColSpan, "colspan", DEFAULT_COLSPAN); // https://html.spec.whatwg.org/multipage/#dom-tdth-cellindex fn CellIndex(&self) -> i32 { |