LibWeb: Simplify iframe sandbox attribute lookup

Fold the has_attribute and attribute call into an if statement
initializer.
This commit is contained in:
Shannon Booth 2026-03-30 21:30:32 +02:00 committed by Alexander Kalenik
parent 0086a7899d
commit e20fd9ba74
Notes: github-actions[bot] 2026-04-01 02:42:20 +00:00

View file

@ -115,11 +115,8 @@ void HTMLIFrameElement::post_connection()
// 2. If insertedNode has a sandbox attribute, then parse the sandboxing directive given the attribute's
// value and insertedNode's iframe sandboxing flag set.
if (has_attribute(AttributeNames::sandbox)) {
auto sandbox_attribute = attribute(AttributeNames::sandbox);
VERIFY(sandbox_attribute.has_value());
m_iframe_sandboxing_flag_set = parse_a_sandboxing_directive(sandbox_attribute.value());
}
if (auto sandbox = attribute(AttributeNames::sandbox); sandbox.has_value())
m_iframe_sandboxing_flag_set = parse_a_sandboxing_directive(sandbox.value());
// 3. Process the iframe attributes for insertedNode, with initialInsertion set to true.
process_the_iframe_attributes(InitialInsertion::Yes);