mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibWeb: Parse "input" tags during the "in body" insertion mode
This commit is contained in:
parent
7aa7a2078f
commit
772b51038e
4 changed files with 26 additions and 0 deletions
|
@ -32,6 +32,7 @@ namespace AttributeNames {
|
||||||
|
|
||||||
FlyString id;
|
FlyString id;
|
||||||
FlyString class_;
|
FlyString class_;
|
||||||
|
FlyString type;
|
||||||
|
|
||||||
void initialize()
|
void initialize()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,7 @@ void initialize()
|
||||||
return;
|
return;
|
||||||
id = "id";
|
id = "id";
|
||||||
class_ = "class";
|
class_ = "class";
|
||||||
|
type = "type";
|
||||||
s_initialized = true;
|
s_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ void initialize();
|
||||||
|
|
||||||
extern FlyString id;
|
extern FlyString id;
|
||||||
extern FlyString class_;
|
extern FlyString class_;
|
||||||
|
extern FlyString type;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -751,6 +751,18 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
||||||
return;
|
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()) {
|
if (token.is_start_tag()) {
|
||||||
reconstruct_the_active_formatting_elements();
|
reconstruct_the_active_formatting_elements();
|
||||||
insert_html_element(token);
|
insert_html_element(token);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/FlyString.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
@ -104,6 +105,16 @@ public:
|
||||||
m_tag.self_closing_acknowledged = true;
|
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; }
|
Type type() const { return m_type; }
|
||||||
|
|
||||||
String to_string() const;
|
String to_string() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue