summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-07 11:35:26 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-07 11:35:26 +0100
commite6712fcd820bf6a5804b33e9be61ee0f147e9edb (patch)
tree96b93a3df8383f658b2c8e4245b3361bcc5850a4
parent7c6de80e81b724e63562771b167e373a8d32ad6d (diff)
downloadserenity-e6712fcd820bf6a5804b33e9be61ee0f147e9edb.zip
LibWeb: Use any_of() for DOM::Element::has_class()
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 443a4711a5..3026e854a0 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <AK/AnyOf.h>
#include <AK/StringBuilder.h>
#include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/Parser/CSSParser.h>
@@ -104,11 +105,7 @@ void Element::remove_attribute(const FlyString& name)
bool Element::has_class(const FlyString& class_name) const
{
- for (auto& class_ : m_classes) {
- if (class_ == class_name)
- return true;
- }
- return false;
+ return any_of(m_classes.begin(), m_classes.end(), [&](auto& it) { return it == class_name; });
}
RefPtr<Layout::Node> Element::create_layout_node()