mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Replace the Str implementation for AttrValue by a Deref implementation.
This commit is contained in:
parent
4108af0c11
commit
41cc0a939e
16 changed files with 43 additions and 41 deletions
|
@ -479,7 +479,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
&atom!("type") => {
|
||||
let value = attr.value();
|
||||
self.input_type.set(match value.as_slice() {
|
||||
self.input_type.set(match &**value {
|
||||
"button" => InputType::InputButton,
|
||||
"submit" => InputType::InputSubmit,
|
||||
"reset" => InputType::InputReset,
|
||||
|
@ -497,18 +497,18 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
&atom!("value") => {
|
||||
if !self.value_changed.get() {
|
||||
self.textinput.borrow_mut().set_content(attr.value().as_slice().to_owned());
|
||||
self.textinput.borrow_mut().set_content((**attr.value()).to_owned());
|
||||
}
|
||||
}
|
||||
&atom!("name") => {
|
||||
if self.input_type.get() == InputType::InputRadio {
|
||||
let value = attr.value();
|
||||
self.radio_group_updated(Some(value.as_slice()));
|
||||
self.radio_group_updated(Some(&value));
|
||||
}
|
||||
}
|
||||
_ if attr.local_name() == &Atom::from_slice("placeholder") => {
|
||||
let value = attr.value();
|
||||
let stripped = value.as_slice().chars()
|
||||
let stripped = value.chars()
|
||||
.filter(|&c| c != '\n' && c != '\r')
|
||||
.collect::<String>();
|
||||
*self.placeholder.borrow_mut() = stripped;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue