mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Avoid some string copies in handle_modify_attribute.
This commit is contained in:
parent
5c11c88e92
commit
13291c4b64
1 changed files with 4 additions and 4 deletions
|
@ -155,12 +155,12 @@ pub fn handle_modify_attribute(page: &Rc<Page>,
|
|||
let node = find_node_by_unique_id(&*page, pipeline, node_id);
|
||||
let elem = node.downcast::<Element>().expect("should be getting layout of element");
|
||||
|
||||
for modification in &modifications {
|
||||
for modification in modifications {
|
||||
match modification.newValue {
|
||||
Some(ref string) => {
|
||||
let _ = elem.SetAttribute(modification.attributeName.clone(), string.clone());
|
||||
Some(string) => {
|
||||
let _ = elem.SetAttribute(modification.attributeName, string);
|
||||
},
|
||||
None => elem.RemoveAttribute(modification.attributeName.clone()),
|
||||
None => elem.RemoveAttribute(modification.attributeName),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue