mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 16:24:59 +00:00
LibHTML: Templatize Node::first_child_of_type<T>()
This is a lot nicer than first_child_with_tag_name(...). The is<T>(Node) functions are obviously unoptimized at the moment, and this is about establishing pleasant patterns right now. :^)
This commit is contained in:
parent
f52f2736e1
commit
3bee9d3d3c
5 changed files with 48 additions and 12 deletions
|
@ -10,3 +10,9 @@ public:
|
|||
virtual void parse_attribute(const String&, const String&) override;
|
||||
virtual void apply_presentational_hints(StyleProperties&) const override;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool is<HTMLBodyElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "body";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue