LibWeb: Indicate documents are for fragment parsing during construction

This will allow testing if they are for fragment parsing during methods
invoked from Document::initialize.
This commit is contained in:
Timothy Flynn 2024-07-31 12:02:38 -04:00 committed by Andreas Kling
parent 2cc2646f55
commit c838ca78c8
Notes: github-actions[bot] 2024-08-01 09:36:56 +00:00
3 changed files with 18 additions and 9 deletions

View file

@ -4269,11 +4269,9 @@ DOM::Document& HTMLParser::document()
Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& context_element, StringView markup, AllowDeclarativeShadowRoots allow_declarative_shadow_roots)
{
// 1. Create a new Document node, and mark it as being an HTML document.
auto temp_document = DOM::Document::create(context_element.realm());
auto temp_document = DOM::Document::create_for_fragment_parsing(context_element.realm());
temp_document->set_document_type(DOM::Document::Type::HTML);
temp_document->set_is_temporary_document_for_fragment_parsing({});
// 2. If the node document of the context element is in quirks mode, then let the Document be in quirks mode.
// Otherwise, the node document of the context element is in limited-quirks mode, then let the Document be in limited-quirks mode.
// Otherwise, leave the Document in no-quirks mode.