mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
LibWeb: Return an Optional<String> from HTMLToken::attribute
Move away from using a nullable StringView.
This commit is contained in:
parent
72bb928dd8
commit
96fc1741b5
Notes:
sideshowbarker
2024-07-16 23:44:30 +09:00
Author: https://github.com/shannonbooth
Commit: 96fc1741b5
Pull-request: https://github.com/SerenityOS/serenity/pull/21880
2 changed files with 5 additions and 8 deletions
|
@ -245,7 +245,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
StringView attribute(FlyString const& attribute_name) const
|
||||
Optional<String> attribute(FlyString const& attribute_name) const
|
||||
{
|
||||
if (auto result = raw_attribute(attribute_name); result.has_value())
|
||||
return result->value;
|
||||
|
@ -268,7 +268,7 @@ public:
|
|||
|
||||
bool has_attribute(FlyString const& attribute_name) const
|
||||
{
|
||||
return !attribute(attribute_name).is_null();
|
||||
return attribute(attribute_name).has_value();
|
||||
}
|
||||
|
||||
void adjust_tag_name(FlyString const& old_name, FlyString const& new_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue