1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +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

@ -99,17 +99,12 @@ public:
bool has_attributes() const;
// FIXME: This should be taking a 'FlyString const&'
DeprecatedString deprecated_attribute(StringView name) const { return get_attribute(name); }
Optional<String> attribute(StringView name) const
{
auto ret = deprecated_attribute(name);
if (ret.is_null())
return {};
return String::from_deprecated_string(ret).release_value();
}
DeprecatedString deprecated_attribute(StringView name) const { return deprecated_get_attribute(name); }
Optional<String> attribute(StringView name) const { return get_attribute(name); }
// FIXME: This should be taking a 'FlyString const&' / 'Optional<FlyString> const&'
DeprecatedString get_attribute(StringView name) const;
Optional<String> get_attribute(StringView name) const;
DeprecatedString deprecated_get_attribute(StringView name) const;
DeprecatedString get_attribute_value(StringView local_name, DeprecatedFlyString const& namespace_ = {}) const;
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
@ -257,7 +252,7 @@ public:
#define ARIA_IMPL(name, attribute) \
DeprecatedString name() const override \
{ \
return get_attribute(attribute); \
return deprecated_get_attribute(attribute); \
} \
\
WebIDL::ExceptionOr<void> set_##name(DeprecatedString const& value) override \