mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 10:24:59 +00:00
LibWeb: Yet more work towards parsing www/welcome.html :^)
This commit is contained in:
parent
45da08a1e6
commit
65d8d5e83e
4 changed files with 111 additions and 7 deletions
|
@ -3,13 +3,14 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
static Vector<FlyString> s_base_list { "applet", "caption", "html", "table", "td", "th", "marquee", "object", "template" };
|
||||
|
||||
StackOfOpenElements::~StackOfOpenElements()
|
||||
{
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
|
||||
bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString> &list) const
|
||||
{
|
||||
static Vector<FlyString> list { "applet", "caption", "html", "table", "td", "th", "marquee", "object", "template" };
|
||||
for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
|
||||
auto& node = m_elements.at(i);
|
||||
if (node.tag_name() == tag_name)
|
||||
|
@ -20,4 +21,16 @@ bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
|
||||
{
|
||||
return has_in_scope_impl(tag_name, s_base_list);
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_button_scope(const FlyString& tag_name) const
|
||||
{
|
||||
auto list = s_base_list;
|
||||
list.append("button");
|
||||
return has_in_scope_impl(tag_name, list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue