mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibWeb: Make Element attribute getters take a StringView
These functions are deferring to NamedNodeMap::get_attribute which already takes a StringView. This changes also leads to finding some places which were passing though a const char* instead of an entry from Attribute names. Fix that where applicable, and switch to has_attribute in some of those places instead of deprecated_attribute where equivalent. Ideally this should be taking a 'FlyString const&', but to continue porting away from DeprecatedString, just leave a FIXME for now.
This commit is contained in:
parent
dbf8ff64fb
commit
47514e07b4
6 changed files with 64 additions and 63 deletions
|
@ -131,7 +131,7 @@ void Element::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-getattribute
|
||||
DeprecatedString Element::get_attribute(DeprecatedFlyString const& name) const
|
||||
DeprecatedString Element::get_attribute(StringView name) const
|
||||
{
|
||||
// 1. Let attr be the result of getting an attribute given qualifiedName and this.
|
||||
auto const* attribute = m_attributes->get_attribute(name);
|
||||
|
@ -145,7 +145,7 @@ DeprecatedString Element::get_attribute(DeprecatedFlyString const& name) const
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-get-value
|
||||
DeprecatedString Element::get_attribute_value(DeprecatedFlyString const& local_name, DeprecatedFlyString const& namespace_) const
|
||||
DeprecatedString Element::get_attribute_value(StringView local_name, DeprecatedFlyString 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue