diff --git a/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Libraries/LibWeb/Bindings/AudioConstructor.cpp index 87bda24cdc2..d25413d9c25 100644 --- a/Libraries/LibWeb/Bindings/AudioConstructor.cpp +++ b/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -44,7 +44,7 @@ JS::ThrowCompletionOr> AudioConstructor::construct(FunctionO auto& window = verify_cast(HTML::current_principal_global_object()); auto& document = window.associated_document(); - // 2. Let audio be the result of creating an element given document, audio, and the HTML namespace. + // 2. Let audio be the result of creating an element given document, "audio", and the HTML namespace. auto audio = TRY(Bindings::throw_dom_exception_if_needed(vm, [&]() { return DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML); })); // 3. Set an attribute value for audio using "preload" and "auto". diff --git a/Libraries/LibWeb/Bindings/ImageConstructor.cpp b/Libraries/LibWeb/Bindings/ImageConstructor.cpp index 4e275433983..c96d0dcca3f 100644 --- a/Libraries/LibWeb/Bindings/ImageConstructor.cpp +++ b/Libraries/LibWeb/Bindings/ImageConstructor.cpp @@ -45,7 +45,7 @@ JS::ThrowCompletionOr> ImageConstructor::construct(FunctionO auto& window = verify_cast(HTML::current_principal_global_object()); auto& document = window.associated_document(); - // 2. Let img be the result of creating an element given document, img, and the HTML namespace. + // 2. Let img be the result of creating an element given document, "img", and the HTML namespace. auto image_element = TRY(Bindings::throw_dom_exception_if_needed(vm, [&]() { return DOM::create_element(document, HTML::TagNames::img, Namespace::HTML); })); // 3. If width is given, then set an attribute value for img using "width" and width. diff --git a/Libraries/LibWeb/Bindings/OptionConstructor.cpp b/Libraries/LibWeb/Bindings/OptionConstructor.cpp index fc6ae0ed46c..a600d9c3b3c 100644 --- a/Libraries/LibWeb/Bindings/OptionConstructor.cpp +++ b/Libraries/LibWeb/Bindings/OptionConstructor.cpp @@ -54,7 +54,7 @@ JS::ThrowCompletionOr> OptionConstructor::construct(Function auto& window = verify_cast(HTML::current_principal_global_object()); auto& document = window.associated_document(); - // 2. Let option be the result of creating an element given document, option, and the HTML namespace. + // 2. Let option be the result of creating an element given document, "option", and the HTML namespace. auto element = TRY(Bindings::throw_dom_exception_if_needed(vm, [&]() { return DOM::create_element(document, HTML::TagNames::option, Namespace::HTML); })); GC::Ref option_element = verify_cast(*element); diff --git a/Libraries/LibWeb/DOM/Attr.cpp b/Libraries/LibWeb/DOM/Attr.cpp index 8ce937757ec..d556b699db7 100644 --- a/Libraries/LibWeb/DOM/Attr.cpp +++ b/Libraries/LibWeb/DOM/Attr.cpp @@ -101,7 +101,8 @@ void Attr::handle_attribute_changes(Element& element, Optional const& ol // 1. Queue a mutation record of "attributes" for element with attribute’s local name, attribute’s namespace, oldValue, « », « », null, and null. element.queue_mutation_record(MutationType::attributes, local_name(), namespace_uri(), old_value, {}, {}, nullptr, nullptr); - // 2. If element is custom, then enqueue a custom element callback reaction with element, callback name "attributeChangedCallback", and an argument list containing attribute’s local name, oldValue, newValue, and attribute’s namespace. + // 2. If element is custom, then enqueue a custom element callback reaction with element, callback name "attributeChangedCallback", + // and « attribute’s local name, oldValue, newValue, attribute’s namespace ». if (element.is_custom()) { auto& vm = this->vm(); diff --git a/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Libraries/LibWeb/DOM/DOMImplementation.cpp index d5cad4ff318..1ff325a5654 100644 --- a/Libraries/LibWeb/DOM/DOMImplementation.cpp +++ b/Libraries/LibWeb/DOM/DOMImplementation.cpp @@ -106,17 +106,17 @@ GC::Ref DOMImplementation::create_html_document(Optional const doctype->set_name("html"_string); MUST(html_document->append_child(*doctype)); - // 4. Append the result of creating an element given doc, html, and the HTML namespace, to doc. + // 4. Append the result of creating an element given doc, "html", and the HTML namespace, to doc. auto html_element = create_element(html_document, HTML::TagNames::html, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); MUST(html_document->append_child(html_element)); - // 5. Append the result of creating an element given doc, head, and the HTML namespace, to the html element created earlier. + // 5. Append the result of creating an element given doc, "head", and the HTML namespace, to the html element created earlier. auto head_element = create_element(html_document, HTML::TagNames::head, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); MUST(html_element->append_child(head_element)); // 6. If title is given: if (title.has_value()) { - // 1. Append the result of creating an element given doc, title, and the HTML namespace, to the head element created earlier. + // 1. Append the result of creating an element given doc, "title", and the HTML namespace, to the head element created earlier. auto title_element = create_element(html_document, HTML::TagNames::title, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); MUST(head_element->append_child(title_element)); @@ -125,7 +125,7 @@ GC::Ref DOMImplementation::create_html_document(Optional const MUST(title_element->append_child(*text_node)); } - // 7. Append the result of creating an element given doc, body, and the HTML namespace, to the html element created earlier. + // 7. Append the result of creating an element given doc, "body", and the HTML namespace, to the html element created earlier. auto body_element = create_element(html_document, HTML::TagNames::body, Namespace::HTML).release_value_but_fixme_should_propagate_errors(); MUST(html_element->append_child(body_element)); diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index b8920dacc27..a9f160c150b 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -442,13 +442,13 @@ void Document::initialize(JS::Realm& realm) // https://html.spec.whatwg.org/multipage/document-lifecycle.html#populate-with-html/head/body WebIDL::ExceptionOr Document::populate_with_html_head_and_body() { - // 1. Let html be the result of creating an element given document, html, and the HTML namespace. + // 1. Let html be the result of creating an element given document, "html", and the HTML namespace. auto html = TRY(DOM::create_element(*this, HTML::TagNames::html, Namespace::HTML)); - // 2. Let head be the result of creating an element given document, head, and the HTML namespace. + // 2. Let head be the result of creating an element given document, "head", and the HTML namespace. auto head = TRY(DOM::create_element(*this, HTML::TagNames::head, Namespace::HTML)); - // 3. Let body be the result of creating an element given document, body, and the HTML namespace. + // 3. Let body be the result of creating an element given document, "body", and the HTML namespace. auto body = TRY(DOM::create_element(*this, HTML::TagNames::body, Namespace::HTML)); // 4. Append html to document. @@ -930,7 +930,7 @@ WebIDL::ExceptionOr Document::set_title(String const& title) } // 2. Otherwise: else { - // 1. Let element be the result of creating an element given the document element's node document, title, + // 1. Let element be the result of creating an element given the document element's node document, "title", // and the SVG namespace. element = TRY(DOM::create_element(*this, HTML::TagNames::title, Namespace::SVG)); @@ -959,7 +959,7 @@ WebIDL::ExceptionOr Document::set_title(String const& title) } // 3. Otherwise: else { - // 1. Let element be the result of creating an element given the document element's node document, title, + // 1. Let element be the result of creating an element given the document element's node document, "title", // and the HTML namespace. element = TRY(DOM::create_element(*this, HTML::TagNames::title, Namespace::HTML)); diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 65b3b11a60d..6bb49dc18f6 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -1520,7 +1520,7 @@ WebIDL::ExceptionOr Element::set_outer_html(String const& value) if (parent->is_document()) return WebIDL::NoModificationAllowedError::create(realm(), "Cannot set outer HTML on document"_string); - // 5. If parent is a DocumentFragment, set parent to the result of creating an element given this's node document, body, and the HTML namespace. + // 5. If parent is a DocumentFragment, set parent to the result of creating an element given this's node document, "body", and the HTML namespace. if (parent->is_document_fragment()) parent = TRY(create_element(document(), HTML::TagNames::body, Namespace::HTML)); @@ -2084,7 +2084,7 @@ JS::ThrowCompletionOr Element::upgrade_element(GC::Reflength(); ++attribute_index) { auto const* attribute = m_attributes->item(attribute_index); VERIFY(attribute); @@ -2099,7 +2099,7 @@ JS::ThrowCompletionOr Element::upgrade_element(GC::Ref empty_arguments { vm.heap() }; enqueue_a_custom_element_callback_reaction(HTML::CustomElementReactionNames::connectedCallback, move(empty_arguments)); diff --git a/Libraries/LibWeb/DOM/Range.cpp b/Libraries/LibWeb/DOM/Range.cpp index e72067d7639..91c103b6536 100644 --- a/Libraries/LibWeb/DOM/Range.cpp +++ b/Libraries/LibWeb/DOM/Range.cpp @@ -1275,7 +1275,7 @@ WebIDL::ExceptionOr> Range::create_contextual_fragment // - element's namespace is the HTML namespace; if (!element || is(*element)) { // then set element to the result of creating an element given this's node document, - // body, and the HTML namespace. + // "body", and the HTML namespace. element = TRY(DOM::create_element(node->document(), HTML::TagNames::body, Namespace::HTML)); } diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp index 4189adf3015..7a300f9893a 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -237,7 +237,7 @@ GC::Ref HTMLElement::rendered_text_fragment(StringView in input = input.substring_view(1); } - // 3. Append the result of creating an element given document, br, and the HTML namespace to fragment. + // 3. Append the result of creating an element given document, "br", and the HTML namespace to fragment. auto br_element = DOM::create_element(document(), HTML::TagNames::br, Namespace::HTML).release_value(); MUST(fragment->append_child(br_element)); } diff --git a/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index 4c4d37882a9..ebdf3103ba7 100644 --- a/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -142,7 +142,7 @@ WebIDL::ExceptionOr> HTMLTableRowElement::insert_c if (index < -1 || index > cells_collection_size) return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of cells"_string); - // 2. Let table cell be the result of creating an element given this tr element's node document, td, and the HTML namespace. + // 2. Let table cell be the result of creating an element given this tr element's node document, "td", and the HTML namespace. auto& table_cell = static_cast(*TRY(DOM::create_element(document(), HTML::TagNames::td, Namespace::HTML))); // 3. If index is equal to −1 or equal to the number of items in cells collection, then append table cell to this tr element. diff --git a/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index 21ed29ea995..f00c8b69d2f 100644 --- a/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -64,7 +64,7 @@ WebIDL::ExceptionOr> HTMLTableSectionElement::inser if (index < -1 || index > rows_collection_size) return WebIDL::IndexSizeError::create(realm(), "Index is negative or greater than the number of rows"_string); - // 2. Let table row be the result of creating an element given this element's node document, tr, and the HTML namespace. + // 2. Let table row be the result of creating an element given this element's node document, "tr", and the HTML namespace. auto& table_row = static_cast(*TRY(DOM::create_element(document(), TagNames::tr, Namespace::HTML))); // 3. If index is −1 or equal to the number of items in the rows collection, then append table row to this element. diff --git a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 0ece3afcfb1..923b945bc89 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -735,10 +735,10 @@ GC::Ref HTMLParser::create_element_for(HTMLToken const& token, Opt // 6. Let definition be the result of looking up a custom element definition given document, given namespace, local name, and is. auto definition = document->lookup_custom_element_definition(namespace_, local_name, is_value); - // 7. If definition is non-null and the parser was not created as part of the HTML fragment parsing algorithm, then let will execute script be true. Otherwise, let it be false. + // 7. Let willExecuteScript be true if definition is non-null and the parser was not created as part of the HTML fragment parsing algorithm; otherwise false. bool will_execute_script = definition && !m_parsing_fragment; - // 8. If will execute script is true, then: + // 8. If willExecuteScript is true: if (will_execute_script) { // 1. Increment document's throw-on-dynamic-markup-insertion counter. document->increment_throw_on_dynamic_markup_insertion_counter({}); @@ -753,8 +753,7 @@ GC::Ref HTMLParser::create_element_for(HTMLToken const& token, Opt custom_data.custom_element_reactions_stack.element_queue_stack.append({}); } - // 9. Let element be the result of creating an element given document, localName, given namespace, null, and is. - // If will execute script is true, set the synchronous custom elements flag; otherwise, leave it unset. + // 9. Let element be the result of creating an element given document, localName, given namespace, null, is, and willExecuteScript. auto element = create_element(*document, local_name, namespace_, {}, is_value, will_execute_script).release_value_but_fixme_should_propagate_errors(); // 10. Append each attribute in the given token to element. @@ -765,7 +764,7 @@ GC::Ref HTMLParser::create_element_for(HTMLToken const& token, Opt return IterationDecision::Continue; }); - // 11. If will execute script is true, then: + // 11. If willExecuteScript is true: if (will_execute_script) { // 1. Let queue be the result of popping from document's relevant agent's custom element reactions stack. (This will be the same element queue as was pushed above.) auto& vm = main_thread_event_loop().vm();