mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:45:09 +00:00
LibHTML: Add is<ElementType> and to<ElementType> helper functions
These will help us write node-type-aware template functions.
This commit is contained in:
parent
bedb00603c
commit
f52f2736e1
12 changed files with 93 additions and 22 deletions
|
@ -56,7 +56,7 @@ RefPtr<LayoutNode> Node::create_layout_tree(const StyleResolver& resolver, const
|
|||
|
||||
const HTMLAnchorElement* Node::enclosing_link_element() const
|
||||
{
|
||||
if (is_element() && tag_name().to_lowercase() == "a")
|
||||
if (is<HTMLAnchorElement>(*this))
|
||||
return static_cast<const HTMLAnchorElement*>(this);
|
||||
return parent() ? parent()->enclosing_link_element() : nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue