1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:28:11 +00:00

LibWeb: Add a helper for creating a fake (start tag) HTML token

Sometimes the parsing rules say we need to insert a fake HTML token.
Let's have a convenient way of doing that!
This commit is contained in:
Andreas Kling 2020-07-23 17:30:03 +02:00
parent aaf6014ae1
commit 6e02ef19d1
3 changed files with 19 additions and 34 deletions

View file

@ -58,6 +58,14 @@ public:
return token;
}
static HTMLToken make_start_tag(const FlyString& tag_name)
{
HTMLToken token;
token.m_type = Type::StartTag;
token.m_tag.tag_name.append(tag_name);
return token;
}
bool is_doctype() const { return m_type == Type::DOCTYPE; }
bool is_start_tag() const { return m_type == Type::StartTag; }
bool is_end_tag() const { return m_type == Type::EndTag; }