mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Prefer atoms over strs for string comparisons
This commit is contained in:
parent
ef18b49b35
commit
7b8d5bbb97
1 changed files with 6 additions and 6 deletions
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue