1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +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:
Andreas Kling 2019-10-06 20:37:39 +02:00
parent bedb00603c
commit f52f2736e1
12 changed files with 93 additions and 22 deletions

View file

@ -29,11 +29,8 @@ StyleResolver& Document::style_resolver()
void Document::normalize()
{
if (first_child() != nullptr && first_child()->is_element()) {
const Element& el = static_cast<const Element&>(*first_child());
if (el.tag_name() == "html")
return;
}
if (is<HTMLHtmlElement>(first_child()))
return;
NonnullRefPtr<Element> body = adopt(*new Element(*this, "body"));
NonnullRefPtr<Element> html = adopt(*new Element(*this, "html"));