mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
LibWeb: Port AttributeNames to FlyString
This commit is contained in:
parent
6a3f27509f
commit
e4f8c59210
93 changed files with 148 additions and 149 deletions
|
@ -247,28 +247,29 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
StringView attribute(DeprecatedFlyString const& attribute_name) const
|
||||
StringView attribute(FlyString const& attribute_name) const
|
||||
{
|
||||
if (auto result = raw_attribute(attribute_name); result.has_value())
|
||||
return result->value;
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<Attribute const&> raw_attribute(DeprecatedFlyString const& attribute_name) const
|
||||
Optional<Attribute const&> raw_attribute(FlyString const& attribute_name) const
|
||||
{
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
|
||||
auto deprecated_attribute_name = attribute_name.to_deprecated_fly_string();
|
||||
auto* ptr = tag_attributes();
|
||||
if (!ptr)
|
||||
return {};
|
||||
for (auto& attribute : *ptr) {
|
||||
if (attribute_name == attribute.local_name)
|
||||
if (deprecated_attribute_name == attribute.local_name)
|
||||
return attribute;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool has_attribute(DeprecatedFlyString const& attribute_name)
|
||||
bool has_attribute(FlyString const& attribute_name) const
|
||||
{
|
||||
return !attribute(attribute_name).is_null();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue