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:
Alan Jeffrey 2015-11-11 17:30:23 -06:00
parent 034769f280
commit 5db67b5981
5 changed files with 23 additions and 5 deletions

View file

@ -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'));
}
},