From 989c2f9e8783f19b0ae36428a7eddd6e82806ac6 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Wed, 4 Dec 2024 19:10:31 +0900 Subject: [PATCH] LibWeb: Use el.aria_foo(), not el.has_attribute("aria-foo"_string) This change replaces some element.has_attribute("aria-foo"_string) calls with element.aria_value_foo() calls instead. --- Libraries/LibWeb/DOM/Node.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index 6fc5a3f7bb6..f66c5db8a09 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -2374,13 +2374,15 @@ ErrorOr Node::name_or_description(NameOrDescription target, Document con } } } else if (role == ARIA::Role::spinbutton || role == ARIA::Role::slider) { + auto aria_valuenow = element.aria_value_now(); + auto aria_valuetext = element.aria_value_text(); // iii. Range: If the embedded control has role range (e.g., a spinbutton or slider): // a. If the aria-valuetext property is present, return its value, - if (element.has_attribute("aria-valuetext"_string)) - builder.append(element.get_attribute("aria-valuetext"_string).value()); + if (aria_valuetext.has_value()) + builder.append(aria_valuetext.value()); // b. Otherwise, if the aria-valuenow property is present, return its value - else if (element.has_attribute("aria-valuenow"_string)) - builder.append(element.get_attribute("aria-valuenow"_string).value()); + else if (aria_valuenow.has_value()) + builder.append(aria_valuenow.value()); // c. Otherwise, use the value as specified by a host language attribute. else if (is(*node)) { auto const& element = static_cast(*node);