Skip to content

Commit

Permalink
Use atom's for matching to gain performance benefits
Browse files Browse the repository at this point in the history
  • Loading branch information
iszak committed Jan 3, 2016
1 parent 618c107 commit 603d0a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions components/script/dom/htmlinputelement.rs
Expand Up @@ -570,14 +570,14 @@ impl VirtualMethods for HTMLInputElement {
&atom!("type") => {
match mutation {
AttributeMutation::Set(_) => {
let value = match &**attr.value() {
"button" => InputType::InputButton,
"submit" => InputType::InputSubmit,
"reset" => InputType::InputReset,
"file" => InputType::InputFile,
"radio" => InputType::InputRadio,
"checkbox" => InputType::InputCheckbox,
"password" => InputType::InputPassword,
let value = match attr.value().as_atom() {
&atom!("button") => InputType::InputButton,
&atom!("submit") => InputType::InputSubmit,
&atom!("reset") => InputType::InputReset,
&atom!("file") => InputType::InputFile,
&atom!("radio") => InputType::InputRadio,
&atom!("checkbox") => InputType::InputCheckbox,
&atom!("password") => InputType::InputPassword,
_ => InputType::InputText,
};
self.input_type.set(value);
Expand Down

0 comments on commit 603d0a5

Please sign in to comment.