diff options
-rw-r--r-- | Libraries/LibHTML/DOM/HTMLStyleElement.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp index d527b58dcf..e4f71012b8 100644 --- a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp @@ -1,5 +1,7 @@ +#include <AK/StringBuilder.h> #include <LibHTML/DOM/Document.h> #include <LibHTML/DOM/HTMLStyleElement.h> +#include <LibHTML/DOM/Text.h> #include <LibHTML/Parser/CSSParser.h> HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name) @@ -13,7 +15,12 @@ HTMLStyleElement::~HTMLStyleElement() void HTMLStyleElement::inserted_into(Node& new_parent) { - m_stylesheet = parse_css(text_content()); + StringBuilder builder; + for_each_child([&](auto& child) { + if (is<Text>(child)) + builder.append(to<Text>(child).text_content()); + }); + m_stylesheet = parse_css(builder.to_string()); if (m_stylesheet) document().add_sheet(*m_stylesheet); HTMLElement::inserted_into(new_parent); |