mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
||||
fn Labels(&self) -> Root<NodeList> {
|
||||
if &*self.type_() == "hidden" {
|
||||
if self.type_() == atom!("hidden") {
|
||||
let window = window_from_node(self);
|
||||
NodeList::empty(&window)
|
||||
} else {
|
||||
|
@ -418,14 +418,14 @@ impl HTMLInputElement {
|
|||
_ => false
|
||||
};
|
||||
|
||||
match &*ty {
|
||||
"submit" | "button" | "reset" if !is_submitter => return None,
|
||||
"radio" | "checkbox" => {
|
||||
match ty {
|
||||
atom!("submit") | atom!("button") | atom!("reset") if !is_submitter => return None,
|
||||
atom!("radio") | atom!("checkbox") => {
|
||||
if !self.Checked() || name.is_empty() {
|
||||
return None;
|
||||
}
|
||||
},
|
||||
"image" | "file" => return None, // Unimplemented
|
||||
atom!("image") | atom!("file") => return None, // Unimplemented
|
||||
_ => {
|
||||
if name.is_empty() {
|
||||
return None;
|
||||
|
@ -434,7 +434,7 @@ impl HTMLInputElement {
|
|||
}
|
||||
|
||||
let mut value = self.Value();
|
||||
if &*ty == "radio" || &*ty == "checkbox" {
|
||||
if ty == atom!("radio") || ty == atom!("checkbox") {
|
||||
if value.is_empty() {
|
||||
value = DOMString::from("on");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue