mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
LibWeb: Fix a few const-ness issues
This commit is contained in:
parent
70a2ca7fc0
commit
c0b2fa74ac
36 changed files with 123 additions and 121 deletions
|
@ -17,9 +17,9 @@ namespace Web::DOM {
|
|||
template<typename NodeType>
|
||||
class NonElementParentNode {
|
||||
public:
|
||||
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id) const
|
||||
JS::GCPtr<Element const> get_element_by_id(DeprecatedFlyString const& id) const
|
||||
{
|
||||
JS::GCPtr<Element> found_element;
|
||||
JS::GCPtr<Element const> found_element;
|
||||
static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.attribute(HTML::AttributeNames::id) == id) {
|
||||
found_element = &element;
|
||||
|
@ -29,9 +29,18 @@ public:
|
|||
});
|
||||
return found_element;
|
||||
}
|
||||
|
||||
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id)
|
||||
{
|
||||
return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id);
|
||||
JS::GCPtr<Element> found_element;
|
||||
static_cast<NodeType*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.attribute(HTML::AttributeNames::id) == id) {
|
||||
found_element = &element;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_element;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue