1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:27:35 +00:00

LibWeb: Add namespace to Element

This commit is contained in:
Luke 2020-10-10 02:48:05 +01:00 committed by Andreas Kling
parent efaf03e986
commit e8a9e8aed5
167 changed files with 505 additions and 340 deletions

View file

@ -49,11 +49,11 @@ ConsoleWidget::ConsoleWidget()
auto base_document = adopt(*new Web::DOM::Document);
base_document->append_child(adopt(*new Web::DOM::DocumentType(base_document)));
auto html_element = Web::DOM::create_element(base_document, "html");
auto html_element = base_document->create_element("html");
base_document->append_child(html_element);
auto head_element = Web::DOM::create_element(base_document, "head");
auto head_element = base_document->create_element("head");
html_element->append_child(head_element);
auto body_element = Web::DOM::create_element(base_document, "body");
auto body_element = base_document->create_element("body");
html_element->append_child(body_element);
m_output_container = body_element;
@ -149,7 +149,7 @@ void ConsoleWidget::print_source_line(const StringView& source)
void ConsoleWidget::print_html(const StringView& line)
{
auto paragraph = create_element(m_output_container->document(), "p");
auto paragraph = m_output_container->document().create_element("p");
paragraph->set_inner_html(line);
m_output_container->append_child(paragraph);

View file

@ -42,14 +42,14 @@ IRCLogBuffer::IRCLogBuffer()
{
m_document = adopt(*new Web::DOM::Document);
m_document->append_child(adopt(*new Web::DOM::DocumentType(document())));
auto html_element = create_element(document(), "html");
auto html_element = m_document->create_element("html");
m_document->append_child(html_element);
auto head_element = create_element(document(), "head");
auto head_element = m_document->create_element("head");
html_element->append_child(head_element);
auto style_element = create_element(document(), "style");
auto style_element = m_document->create_element("style");
style_element->append_child(adopt(*new Web::DOM::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
head_element->append_child(style_element);
auto body_element = create_element(document(), "body");
auto body_element = m_document->create_element("body");
html_element->append_child(body_element);
m_container_element = body_element;
}
@ -76,7 +76,7 @@ void IRCLogBuffer::add_message(char prefix, const String& name, const String& te
escape_html_entities(nick_string),
escape_html_entities(text));
auto wrapper = Web::DOM::create_element(*m_document, Web::HTML::TagNames::div);
auto wrapper = m_document->create_element(Web::HTML::TagNames::div);
wrapper->set_attribute(Web::HTML::AttributeNames::style, String::formatted("color: {}", color.to_string()));
wrapper->set_inner_html(html);
m_container_element->append_child(wrapper);
@ -90,7 +90,7 @@ void IRCLogBuffer::add_message(const String& text, Color color)
"<span>{}</span>",
timestamp_string(),
escape_html_entities(text));
auto wrapper = Web::DOM::create_element(*m_document, Web::HTML::TagNames::div);
auto wrapper = m_document->create_element(Web::HTML::TagNames::div);
wrapper->set_attribute(Web::HTML::AttributeNames::style, String::formatted("color: {}", color.to_string()));
wrapper->set_inner_html(html);
m_container_element->append_child(wrapper);