|
|
@ -95,7 +95,7 @@
|
|
|
|
namespace Web::DOM {
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#concept-create-element
|
|
|
|
// https://dom.spec.whatwg.org/#concept-create-element
|
|
|
|
JS::NonnullGCPtr<Element> create_element(Document& document, DeprecatedFlyString local_name, DeprecatedFlyString namespace_, DeprecatedFlyString prefix)
|
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(Document& document, DeprecatedFlyString local_name, DeprecatedFlyString namespace_, DeprecatedFlyString prefix)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 1. If prefix was not given, let prefix be null.
|
|
|
|
// 1. If prefix was not given, let prefix be null.
|
|
|
|
// NOTE: This is already taken care of by `prefix` having a default value.
|
|
|
|
// NOTE: This is already taken care of by `prefix` having a default value.
|
|
|
@ -120,180 +120,180 @@ JS::NonnullGCPtr<Element> create_element(Document& document, DeprecatedFlyString
|
|
|
|
|
|
|
|
|
|
|
|
auto qualified_name = QualifiedName { local_name, prefix, namespace_ };
|
|
|
|
auto qualified_name = QualifiedName { local_name, prefix, namespace_ };
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::a)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::a)
|
|
|
|
return realm.heap().allocate<HTML::HTMLAnchorElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLAnchorElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::area)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::area)
|
|
|
|
return realm.heap().allocate<HTML::HTMLAreaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLAreaElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::audio)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::audio)
|
|
|
|
return realm.heap().allocate<HTML::HTMLAudioElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLAudioElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::base)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::base)
|
|
|
|
return realm.heap().allocate<HTML::HTMLBaseElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLBaseElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::blink)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::blink)
|
|
|
|
return realm.heap().allocate<HTML::HTMLBlinkElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLBlinkElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::body)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::body)
|
|
|
|
return realm.heap().allocate<HTML::HTMLBodyElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLBodyElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::br)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::br)
|
|
|
|
return realm.heap().allocate<HTML::HTMLBRElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLBRElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::button)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::button)
|
|
|
|
return realm.heap().allocate<HTML::HTMLButtonElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLButtonElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::canvas)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::canvas)
|
|
|
|
return realm.heap().allocate<HTML::HTMLCanvasElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLCanvasElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::data)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::data)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDataElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDataElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::datalist)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::datalist)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDataListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDataListElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::details)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::details)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDetailsElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDetailsElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dialog)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dialog)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDialogElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDialogElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dir)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dir)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDirectoryElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDirectoryElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::div)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::div)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDivElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDivElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dl)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::dl)
|
|
|
|
return realm.heap().allocate<HTML::HTMLDListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLDListElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::embed)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::embed)
|
|
|
|
return realm.heap().allocate<HTML::HTMLEmbedElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLEmbedElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::fieldset)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::fieldset)
|
|
|
|
return realm.heap().allocate<HTML::HTMLFieldSetElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLFieldSetElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::font)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::font)
|
|
|
|
return realm.heap().allocate<HTML::HTMLFontElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLFontElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::form)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::form)
|
|
|
|
return realm.heap().allocate<HTML::HTMLFormElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLFormElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::frame)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::frame)
|
|
|
|
return realm.heap().allocate<HTML::HTMLFrameElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLFrameElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::frameset)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::frameset)
|
|
|
|
return realm.heap().allocate<HTML::HTMLFrameSetElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLFrameSetElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::head)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::head)
|
|
|
|
return realm.heap().allocate<HTML::HTMLHeadElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLHeadElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6))
|
|
|
|
return realm.heap().allocate<HTML::HTMLHeadingElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLHeadingElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::hr)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::hr)
|
|
|
|
return realm.heap().allocate<HTML::HTMLHRElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLHRElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::html)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::html)
|
|
|
|
return realm.heap().allocate<HTML::HTMLHtmlElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLHtmlElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::iframe)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::iframe)
|
|
|
|
return realm.heap().allocate<HTML::HTMLIFrameElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLIFrameElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::img)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::img)
|
|
|
|
return realm.heap().allocate<HTML::HTMLImageElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLImageElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::input)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::input)
|
|
|
|
return realm.heap().allocate<HTML::HTMLInputElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLInputElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::label)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::label)
|
|
|
|
return realm.heap().allocate<HTML::HTMLLabelElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLLabelElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::legend)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::legend)
|
|
|
|
return realm.heap().allocate<HTML::HTMLLegendElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLLegendElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::li)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::li)
|
|
|
|
return realm.heap().allocate<HTML::HTMLLIElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLLIElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::link)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::link)
|
|
|
|
return realm.heap().allocate<HTML::HTMLLinkElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLLinkElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::map)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::map)
|
|
|
|
return realm.heap().allocate<HTML::HTMLMapElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLMapElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::marquee)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::marquee)
|
|
|
|
return realm.heap().allocate<HTML::HTMLMarqueeElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLMarqueeElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::menu)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::menu)
|
|
|
|
return realm.heap().allocate<HTML::HTMLMenuElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLMenuElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::meta)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::meta)
|
|
|
|
return realm.heap().allocate<HTML::HTMLMetaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLMetaElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::meter)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::meter)
|
|
|
|
return realm.heap().allocate<HTML::HTMLMeterElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLMeterElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::ins, HTML::TagNames::del))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::ins, HTML::TagNames::del))
|
|
|
|
return realm.heap().allocate<HTML::HTMLModElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLModElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::object)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::object)
|
|
|
|
return realm.heap().allocate<HTML::HTMLObjectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLObjectElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::ol)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::ol)
|
|
|
|
return realm.heap().allocate<HTML::HTMLOListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLOListElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::optgroup)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::optgroup)
|
|
|
|
return realm.heap().allocate<HTML::HTMLOptGroupElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLOptGroupElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::option)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::option)
|
|
|
|
return realm.heap().allocate<HTML::HTMLOptionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLOptionElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::output)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::output)
|
|
|
|
return realm.heap().allocate<HTML::HTMLOutputElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLOutputElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::p)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::p)
|
|
|
|
return realm.heap().allocate<HTML::HTMLParagraphElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLParagraphElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::param)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::param)
|
|
|
|
return realm.heap().allocate<HTML::HTMLParamElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLParamElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::picture)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::picture)
|
|
|
|
return realm.heap().allocate<HTML::HTMLPictureElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLPictureElement>(realm, document, move(qualified_name)));
|
|
|
|
// NOTE: The obsolete elements "listing" and "xmp" are explicitly mapped to HTMLPreElement in the specification.
|
|
|
|
// NOTE: The obsolete elements "listing" and "xmp" are explicitly mapped to HTMLPreElement in the specification.
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp))
|
|
|
|
return realm.heap().allocate<HTML::HTMLPreElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLPreElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::progress)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::progress)
|
|
|
|
return realm.heap().allocate<HTML::HTMLProgressElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLProgressElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::blockquote, HTML::TagNames::q))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::blockquote, HTML::TagNames::q))
|
|
|
|
return realm.heap().allocate<HTML::HTMLQuoteElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLQuoteElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::script)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::script)
|
|
|
|
return realm.heap().allocate<HTML::HTMLScriptElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLScriptElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::select)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::select)
|
|
|
|
return realm.heap().allocate<HTML::HTMLSelectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLSelectElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::slot)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::slot)
|
|
|
|
return realm.heap().allocate<HTML::HTMLSlotElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLSlotElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::source)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::source)
|
|
|
|
return realm.heap().allocate<HTML::HTMLSourceElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLSourceElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::span)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::span)
|
|
|
|
return realm.heap().allocate<HTML::HTMLSpanElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLSpanElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::style)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::style)
|
|
|
|
return realm.heap().allocate<HTML::HTMLStyleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLStyleElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::caption)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::caption)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableCaptionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableCaptionElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th))
|
|
|
|
if (lowercase_tag_name.is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th))
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableCellElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableCellElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::colgroup, HTML::TagNames::col))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::colgroup, HTML::TagNames::col))
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableColElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableColElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::table)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::table)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::tr)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::tr)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableRowElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableRowElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot))
|
|
|
|
if (lowercase_tag_name.is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot))
|
|
|
|
return realm.heap().allocate<HTML::HTMLTableSectionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTableSectionElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::template_)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::template_)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTemplateElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTemplateElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::textarea)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::textarea)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTextAreaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTextAreaElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::time)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::time)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTimeElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTimeElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::title)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::title)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTitleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTitleElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::track)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::track)
|
|
|
|
return realm.heap().allocate<HTML::HTMLTrackElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLTrackElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::ul)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::ul)
|
|
|
|
return realm.heap().allocate<HTML::HTMLUListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLUListElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::video)
|
|
|
|
if (lowercase_tag_name == HTML::TagNames::video)
|
|
|
|
return realm.heap().allocate<HTML::HTMLVideoElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLVideoElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.is_one_of(
|
|
|
|
if (lowercase_tag_name.is_one_of(
|
|
|
|
HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript,
|
|
|
|
HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript,
|
|
|
|
// Obsolete
|
|
|
|
// Obsolete
|
|
|
|
HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt))
|
|
|
|
HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt))
|
|
|
|
return realm.heap().allocate<HTML::HTMLElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::svg)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::svg)
|
|
|
|
return realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name)));
|
|
|
|
// FIXME: Support SVG's mixedCase tag names properly.
|
|
|
|
// FIXME: Support SVG's mixedCase tag names properly.
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::clipPath))
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::clipPath))
|
|
|
|
return realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::circle)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::circle)
|
|
|
|
return realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::defs))
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::defs))
|
|
|
|
return realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::ellipse)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::ellipse)
|
|
|
|
return realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::foreignObject))
|
|
|
|
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::foreignObject))
|
|
|
|
return realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::line)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::line)
|
|
|
|
return realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::path)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::path)
|
|
|
|
return realm.heap().allocate<SVG::SVGPathElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGPathElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::polygon)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::polygon)
|
|
|
|
return realm.heap().allocate<SVG::SVGPolygonElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGPolygonElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::polyline)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::polyline)
|
|
|
|
return realm.heap().allocate<SVG::SVGPolylineElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGPolylineElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::rect)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::rect)
|
|
|
|
return realm.heap().allocate<SVG::SVGRectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGRectElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::g)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::g)
|
|
|
|
return realm.heap().allocate<SVG::SVGGElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGGElement>(realm, document, move(qualified_name)));
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::text)
|
|
|
|
if (lowercase_tag_name == SVG::TagNames::text)
|
|
|
|
return realm.heap().allocate<SVG::SVGTextContentElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGTextContentElement>(realm, document, move(qualified_name)));
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: If name is a valid custom element name, then return HTMLElement.
|
|
|
|
// FIXME: If name is a valid custom element name, then return HTMLElement.
|
|
|
|
|
|
|
|
|
|
|
|
return realm.heap().allocate<HTML::HTMLUnknownElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<HTML::HTMLUnknownElement>(realm, document, move(qualified_name)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|