mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:25:07 +00:00
LibWeb: Declare optional parse results inlined in if
statements
This commit is contained in:
parent
1b9a961fb0
commit
3bfc2f5e95
5 changed files with 40 additions and 65 deletions
|
@ -29,11 +29,9 @@ void HTMLTableColElement::initialize(JS::Realm& realm)
|
|||
unsigned int HTMLTableColElement::span() const
|
||||
{
|
||||
// The span IDL attribute must reflect the content attribute of the same name. It is clamped to the range [1, 1000], and its default value is 1.
|
||||
auto maybe_span_string = get_attribute(HTML::AttributeNames::span);
|
||||
if (maybe_span_string.has_value()) {
|
||||
auto maybe_span = parse_non_negative_integer(maybe_span_string.value());
|
||||
if (maybe_span.has_value())
|
||||
return clamp(maybe_span.value(), 1, 1000);
|
||||
if (auto span_string = get_attribute(HTML::AttributeNames::span); span_string.has_value()) {
|
||||
if (auto span = parse_non_negative_integer(*span_string); span.has_value())
|
||||
return clamp(*span, 1, 1000);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue