/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::DOM { template class NonElementParentNode { public: JS::GCPtr get_element_by_id(DeprecatedFlyString const& id) const { JS::GCPtr 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; } JS::GCPtr get_element_by_id(DeprecatedFlyString const& id) { JS::GCPtr 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; } protected: NonElementParentNode() = default; }; }