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

LibWeb: Set HTMLParser::m_scripting_enabled as according to the spec

This allows <noscript> elements to display their content as proper HTML
instead of raw text when scripting is disabled.
This commit is contained in:
Luke Wilde 2022-09-23 20:43:17 +01:00 committed by Sam Atkins
parent dfe57543a4
commit 7b8a6b8e7a
2 changed files with 7 additions and 1 deletions

View file

@ -121,6 +121,7 @@ static bool is_html_integration_point(DOM::Element const& element)
HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const& encoding)
: m_tokenizer(input, encoding)
, m_scripting_enabled(document.is_scripting_enabled())
, m_document(JS::make_handle(document))
{
m_tokenizer.set_parser({}, *this);
@ -132,7 +133,8 @@ HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const&
}
HTMLParser::HTMLParser(DOM::Document& document)
: m_document(JS::make_handle(document))
: m_scripting_enabled(document.is_scripting_enabled())
, m_document(JS::make_handle(document))
{
m_document->set_parser({}, *this);
m_tokenizer.set_parser({}, *this);

View file

@ -169,7 +169,11 @@ private:
bool m_foster_parenting { false };
bool m_frameset_ok { true };
bool m_parsing_fragment { false };
// https://html.spec.whatwg.org/multipage/parsing.html#scripting-flag
// The scripting flag is set to "enabled" if scripting was enabled for the Document with which the parser is associated when the parser was created, and "disabled" otherwise.
bool m_scripting_enabled { true };
bool m_invoked_via_document_write { false };
bool m_aborted { false };
bool m_parser_pause_flag { false };