mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
LibWeb: Use FlyString for create_element() namespace strings
This commit is contained in:
parent
8f82bd044b
commit
f052823f5f
21 changed files with 65 additions and 64 deletions
|
@ -741,7 +741,7 @@ WebIDL::ExceptionOr<void> Document::set_title(String const& title)
|
|||
else {
|
||||
// 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));
|
||||
element = TRY(DOM::create_element(*this, HTML::TagNames::title, MUST(FlyString::from_deprecated_fly_string(Namespace::SVG))));
|
||||
|
||||
// 2. Insert element as the first child of the document element.
|
||||
document_element->insert_before(*element, nullptr);
|
||||
|
@ -770,7 +770,7 @@ WebIDL::ExceptionOr<void> Document::set_title(String const& title)
|
|||
else {
|
||||
// 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));
|
||||
element = TRY(DOM::create_element(*this, HTML::TagNames::title, MUST(FlyString::from_deprecated_fly_string(Namespace::HTML))));
|
||||
|
||||
// 2. Append element to the head element.
|
||||
TRY(head_element->append_child(*element));
|
||||
|
@ -1356,12 +1356,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(String c
|
|||
}
|
||||
|
||||
// 5. Let namespace be the HTML namespace, if this is an HTML document or this’s content type is "application/xhtml+xml"; otherwise null.
|
||||
DeprecatedFlyString namespace_;
|
||||
Optional<FlyString> namespace_;
|
||||
if (document_type() == Type::HTML || content_type() == "application/xhtml+xml"sv)
|
||||
namespace_ = Namespace::HTML;
|
||||
namespace_ = MUST(FlyString::from_deprecated_fly_string(Namespace::HTML));
|
||||
|
||||
// 6. Return the result of creating an element given this, localName, namespace, null, is, and with the synchronous custom elements flag set.
|
||||
return TRY(DOM::create_element(*this, MUST(FlyString::from_deprecated_fly_string(local_name)), namespace_, {}, move(is_value), true));
|
||||
return TRY(DOM::create_element(*this, MUST(FlyString::from_deprecated_fly_string(local_name)), move(namespace_), {}, move(is_value), true));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createelementns
|
||||
|
@ -1387,7 +1387,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element_ns(Optio
|
|||
}
|
||||
|
||||
// 4. Return the result of creating an element given document, localName, namespace, prefix, is, and with the synchronous custom elements flag set.
|
||||
return TRY(DOM::create_element(*this, extracted_qualified_name.local_name(), extracted_qualified_name.deprecated_namespace_(), extracted_qualified_name.prefix(), move(is_value), true));
|
||||
return TRY(DOM::create_element(*this, extracted_qualified_name.local_name(), extracted_qualified_name.namespace_(), extracted_qualified_name.prefix(), move(is_value), true));
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<DocumentFragment> Document::create_document_fragment()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue