mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
LibWeb: Port Element::get_attribute_value from ByteString
This commit is contained in:
parent
2751f32a18
commit
462f97b28a
3 changed files with 9 additions and 8 deletions
|
@ -130,17 +130,17 @@ ByteString Element::deprecated_get_attribute(StringView name) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-get-value
|
||||
ByteString Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
|
||||
String Element::get_attribute_value(FlyString const& local_name, Optional<FlyString> const& namespace_) const
|
||||
{
|
||||
// 1. Let attr be the result of getting an attribute given namespace, localName, and element.
|
||||
auto const* attribute = m_attributes->get_attribute_ns(namespace_, local_name);
|
||||
|
||||
// 2. If attr is null, then return the empty string.
|
||||
if (!attribute)
|
||||
return ByteString::empty();
|
||||
return String {};
|
||||
|
||||
// 3. Return attr’s value.
|
||||
return attribute->value().to_byte_string();
|
||||
return attribute->value();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattributenode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue