mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use Option<T> to return from getters
This removes the cumbersome &mut bool argument and offers overall a more readable code.
This commit is contained in:
parent
6e1523f4ae
commit
7dfb336be8
22 changed files with 72 additions and 109 deletions
|
@ -47,10 +47,8 @@ impl DOMStringMapMethods for DOMStringMap {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
|
||||
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> DOMString {
|
||||
let attr = self.element.get_custom_attr(name);
|
||||
*found = attr.is_some();
|
||||
attr.unwrap_or_default()
|
||||
fn NamedGetter(&self, name: DOMString) -> Option<DOMString> {
|
||||
self.element.get_custom_attr(name)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface:supported-property-names
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue