/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::DOM { template class NonElementParentNode { public: RefPtr get_element_by_id(const FlyString& id) const { RefPtr found_element; static_cast(this)->template for_each_in_inclusive_subtree_of_type([&](auto& element) { if (element.attribute(HTML::AttributeNames::id) == id) { found_element = &element; return IterationDecision::Break; } return IterationDecision::Continue; }); return found_element; } RefPtr get_element_by_id(const FlyString& id) { return const_cast(this)->get_element_by_id(id); } protected: NonElementParentNode() = default; }; }