mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Reduce 'match' body, remove unnecessary clone
This commit is contained in:
parent
e3dd36f0f3
commit
639fbc2275
1 changed files with 3 additions and 10 deletions
|
@ -48,16 +48,9 @@ impl DOMStringMapMethods for DOMStringMap {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
|
||||||
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> DOMString {
|
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> DOMString {
|
||||||
match self.element.get_custom_attr(name) {
|
let attr = self.element.get_custom_attr(name);
|
||||||
Some(value) => {
|
*found = attr.is_some();
|
||||||
*found = true;
|
attr.unwrap_or_default()
|
||||||
value.clone()
|
|
||||||
},
|
|
||||||
None => {
|
|
||||||
*found = false;
|
|
||||||
DOMString::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface:supported-property-names
|
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface:supported-property-names
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue