1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Port HTMLHyperlinkElementUtils from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-11-20 13:34:37 +13:00 committed by Andreas Kling
parent 9888db1c27
commit 0a4586d510
8 changed files with 64 additions and 67 deletions

View file

@ -424,20 +424,21 @@ Optional<ARIA::Role> HTMLElement::default_role() const
}
// https://html.spec.whatwg.org/multipage/semantics.html#get-an-element's-target
DeprecatedString HTMLElement::get_an_elements_target() const
String HTMLElement::get_an_elements_target() const
{
// To get an element's target, given an a, area, or form element element, run these steps:
// 1. If element has a target attribute, then return that attribute's value.
if (has_attribute(AttributeNames::target))
return deprecated_attribute(AttributeNames::target);
auto maybe_target = attribute(AttributeNames::target);
if (maybe_target.has_value())
return maybe_target.release_value();
// FIXME: 2. If element's node document contains a base element with a
// target attribute, then return the value of the target attribute of the
// first such base element.
// 3. Return the empty string.
return DeprecatedString::empty();
return String {};
}
// https://html.spec.whatwg.org/multipage/links.html#get-an-element's-noopener