1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:28:12 +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

@ -1387,7 +1387,7 @@ bool Node::is_equal_node(Node const* other_node) const
// If A is an element, each attribute in its attribute list has an attribute that equals an attribute in Bs attribute list.
bool has_same_attributes = true;
this_element.for_each_attribute([&](auto& name, auto& value) {
if (other_element.get_attribute(name) != value)
if (other_element.deprecated_get_attribute(name) != value)
has_same_attributes = false;
});
if (!has_same_attributes)
@ -1473,8 +1473,8 @@ DeprecatedString Node::debug_description() const
builder.append(node_name().to_deprecated_fly_string().to_lowercase());
if (is_element()) {
auto& element = static_cast<DOM::Element const&>(*this);
if (auto id = element.get_attribute(HTML::AttributeNames::id); !id.is_null())
builder.appendff("#{}", id);
if (auto id = element.get_attribute(HTML::AttributeNames::id); id.has_value())
builder.appendff("#{}", id.value());
for (auto const& class_name : element.class_names())
builder.appendff(".{}", class_name);
}