mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Added in-place mutation to DOMString.
The methods which are currently implemented are the ones on String that are currently being used: string.push_str(...), string.clear() and string.extend(...). We may want to revisit this API.
This commit is contained in:
parent
034769f280
commit
5db67b5981
5 changed files with 23 additions and 5 deletions
|
@ -576,10 +576,11 @@ impl VirtualMethods for HTMLInputElement {
|
|||
mutation.new_value(attr).as_ref().map(|name| name.as_atom()));
|
||||
},
|
||||
&atom!(placeholder) => {
|
||||
// FIXME(ajeffrey): Should we do in-place mutation of the placeholder?
|
||||
let mut placeholder = self.placeholder.borrow_mut();
|
||||
placeholder.0.clear();
|
||||
placeholder.clear();
|
||||
if let AttributeMutation::Set(_) = mutation {
|
||||
placeholder.0.extend(
|
||||
placeholder.extend(
|
||||
attr.value().chars().filter(|&c| c != '\n' && c != '\r'));
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue