mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:37:36 +00:00
LibWeb: Handle some more parser inputs in the "in head" insertion mode
This commit is contained in:
parent
50265858ab
commit
f62a8d3b19
2 changed files with 31 additions and 3 deletions
|
@ -206,6 +206,23 @@ void HTMLDocumentParser::handle_in_head(HTMLToken& token)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (token.is_doctype()) {
|
||||||
|
PARSE_ERROR();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token.is_start_tag() && token.tag_name() == "html") {
|
||||||
|
process_using_the_rules_for(InsertionMode::InBody, token);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token.is_start_tag() && token.tag_name().is_one_of("base", "basefont", "bgsound", "link")) {
|
||||||
|
insert_html_element(token);
|
||||||
|
m_stack_of_open_elements.pop();
|
||||||
|
token.acknowledge_self_closing_flag_if_set();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (token.is_start_tag() && token.tag_name() == "title") {
|
if (token.is_start_tag() && token.tag_name() == "title") {
|
||||||
insert_html_element(token);
|
insert_html_element(token);
|
||||||
m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
|
m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
|
||||||
|
@ -245,9 +262,7 @@ void HTMLDocumentParser::handle_in_head(HTMLToken& token)
|
||||||
if (token.is_start_tag() && token.tag_name() == "meta") {
|
if (token.is_start_tag() && token.tag_name() == "meta") {
|
||||||
auto element = insert_html_element(token);
|
auto element = insert_html_element(token);
|
||||||
m_stack_of_open_elements.pop();
|
m_stack_of_open_elements.pop();
|
||||||
if (token.is_self_closing()) {
|
token.acknowledge_self_closing_flag_if_set();
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (token.is_end_tag() && token.tag_name() == "head") {
|
if (token.is_end_tag() && token.tag_name() == "head") {
|
||||||
|
|
|
@ -92,6 +92,18 @@ public:
|
||||||
return m_tag.self_closing;
|
return m_tag.self_closing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_acknowledged_self_closing_flag() const
|
||||||
|
{
|
||||||
|
ASSERT(is_self_closing());
|
||||||
|
return m_tag.self_closing_acknowledged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void acknowledge_self_closing_flag_if_set()
|
||||||
|
{
|
||||||
|
if (is_self_closing())
|
||||||
|
m_tag.self_closing_acknowledged = true;
|
||||||
|
}
|
||||||
|
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
|
|
||||||
String to_string() const;
|
String to_string() const;
|
||||||
|
@ -117,6 +129,7 @@ private:
|
||||||
struct {
|
struct {
|
||||||
StringBuilder tag_name;
|
StringBuilder tag_name;
|
||||||
bool self_closing { false };
|
bool self_closing { false };
|
||||||
|
bool self_closing_acknowledged { false };
|
||||||
Vector<AttributeBuilder> attributes;
|
Vector<AttributeBuilder> attributes;
|
||||||
} m_tag;
|
} m_tag;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue