Prefer atoms over strs for string comparisons

This commit is contained in:
Corey Farwell 2015-11-12 23:23:39 -05:00
parent ef18b49b35
commit 7b8d5bbb97

View file

@ -343,7 +343,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels // https://html.spec.whatwg.org/multipage/#dom-lfe-labels
fn Labels(&self) -> Root<NodeList> { fn Labels(&self) -> Root<NodeList> {
if &*self.type_() == "hidden" { if self.type_() == atom!("hidden") {
let window = window_from_node(self); let window = window_from_node(self);
NodeList::empty(&window) NodeList::empty(&window)
} else { } else {
@ -418,14 +418,14 @@ impl HTMLInputElement {
_ => false _ => false
}; };
match &*ty { match ty {
"submit" | "button" | "reset" if !is_submitter => return None, atom!("submit") | atom!("button") | atom!("reset") if !is_submitter => return None,
"radio" | "checkbox" => { atom!("radio") | atom!("checkbox") => {
if !self.Checked() || name.is_empty() { if !self.Checked() || name.is_empty() {
return None; return None;
} }
}, },
"image" | "file" => return None, // Unimplemented atom!("image") | atom!("file") => return None, // Unimplemented
_ => { _ => {
if name.is_empty() { if name.is_empty() {
return None; return None;
@ -434,7 +434,7 @@ impl HTMLInputElement {
} }
let mut value = self.Value(); let mut value = self.Value();
if &*ty == "radio" || &*ty == "checkbox" { if ty == atom!("radio") || ty == atom!("checkbox") {
if value.is_empty() { if value.is_empty() {
value = DOMString::from("on"); value = DOMString::from("on");
} }