1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibWeb: Add a non-DeprecatedString version of Element::get_attribute

Renaming the DeprecatedString version of this function to
Element::get_deprecated_attribute.

While performing this rename, port over functions where it is trivial to
do so to the Optional<String> version of this function.
This commit is contained in:
Shannon Booth 2023-10-01 17:46:26 +13:00 committed by Andreas Kling
parent ebe01b51c8
commit 50350fb79c
17 changed files with 52 additions and 56 deletions

View file

@ -160,9 +160,7 @@ HTMLLinkElement::LinkProcessingOptions HTMLLinkElement::create_link_options()
LinkProcessingOptions options;
// FIXME: destination the result of translating the state of el's as attribute
// crossorigin the state of el's crossorigin content attribute
options.crossorigin = cors_setting_attribute_from_keyword(
has_attribute(AttributeNames::crossorigin) ? String::from_deprecated_string(get_attribute(AttributeNames::crossorigin)).release_value_but_fixme_should_propagate_errors()
: Optional<String> {});
options.crossorigin = cors_setting_attribute_from_keyword(get_attribute(AttributeNames::crossorigin));
// FIXME: referrer policy the state of el's referrerpolicy content attribute
// FIXME: source set el's source set
// base URL document's URL
@ -178,16 +176,16 @@ HTMLLinkElement::LinkProcessingOptions HTMLLinkElement::create_link_options()
// FIXME: cryptographic nonce metadata The current value of el's [[CryptographicNonce]] internal slot
// 3. If el has an href attribute, then set options's href to the value of el's href attribute.
if (has_attribute(AttributeNames::href))
options.href = String::from_deprecated_string(get_attribute(AttributeNames::href)).release_value_but_fixme_should_propagate_errors();
if (auto maybe_href = get_attribute(AttributeNames::href); maybe_href.has_value())
options.href = maybe_href.value();
// 4. If el has an integrity attribute, then set options's integrity to the value of el's integrity content attribute.
if (has_attribute(AttributeNames::integrity))
options.integrity = String::from_deprecated_string(get_attribute(AttributeNames::integrity)).release_value_but_fixme_should_propagate_errors();
if (auto maybe_integrity = get_attribute(AttributeNames::integrity); maybe_integrity.has_value())
options.integrity = maybe_integrity.value();
// 5. If el has a type attribute, then set options's type to the value of el's type attribute.
if (has_attribute(AttributeNames::type))
options.type = String::from_deprecated_string(get_attribute(AttributeNames::type)).release_value_but_fixme_should_propagate_errors();
if (auto maybe_type = get_attribute(AttributeNames::type); maybe_type.has_value())
options.type = maybe_type.value();
// FIXME: 6. Assert: options's href is not the empty string, or options's source set is not null.
// A link element with neither an href or an imagesrcset does not represent a link.