diff --git a/Libraries/LibWeb/DOM/AttributeNames.cpp b/Libraries/LibWeb/DOM/AttributeNames.cpp index 3dacd5f388..c4c5b2b135 100644 --- a/Libraries/LibWeb/DOM/AttributeNames.cpp +++ b/Libraries/LibWeb/DOM/AttributeNames.cpp @@ -32,6 +32,7 @@ namespace AttributeNames { FlyString id; FlyString class_; +FlyString type; void initialize() { @@ -40,6 +41,7 @@ void initialize() return; id = "id"; class_ = "class"; + type = "type"; s_initialized = true; } diff --git a/Libraries/LibWeb/DOM/AttributeNames.h b/Libraries/LibWeb/DOM/AttributeNames.h index a2e6ff4fe5..32e3600a75 100644 --- a/Libraries/LibWeb/DOM/AttributeNames.h +++ b/Libraries/LibWeb/DOM/AttributeNames.h @@ -36,6 +36,7 @@ void initialize(); extern FlyString id; extern FlyString class_; +extern FlyString type; } } diff --git a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp index ead7ee555c..e735d876a5 100644 --- a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp +++ b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp @@ -751,6 +751,18 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) return; } + if (token.is_start_tag() && token.tag_name() == "input") { + reconstruct_the_active_formatting_elements(); + insert_html_element(token); + m_stack_of_open_elements.pop(); + token.acknowledge_self_closing_flag_if_set(); + auto type_attribute = token.attribute(HTML::AttributeNames::type); + if (type_attribute.is_null() || type_attribute != "hidden") { + m_frameset_ok = false; + } + return; + } + if (token.is_start_tag()) { reconstruct_the_active_formatting_elements(); insert_html_element(token); diff --git a/Libraries/LibWeb/Parser/HTMLToken.h b/Libraries/LibWeb/Parser/HTMLToken.h index b309638378..6ff578fba2 100644 --- a/Libraries/LibWeb/Parser/HTMLToken.h +++ b/Libraries/LibWeb/Parser/HTMLToken.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include @@ -104,6 +105,16 @@ public: m_tag.self_closing_acknowledged = true; } + StringView attribute(const FlyString& attribute_name) + { + ASSERT(is_start_tag() || is_end_tag()); + for (auto& attribute : m_tag.attributes) { + if (attribute_name == attribute.name_builder.string_view()) + return attribute.value_builder.string_view(); + } + return {}; + } + Type type() const { return m_type; } String to_string() const;