mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb/Bindings: Generate undefined in a union as 'Empty'
This can only ever be undefined, and no other JS value, so it makes sense to use undefined to represent this case.
This commit is contained in:
committed by
Tim Ledbetter
parent
fef1f62ecc
commit
dfdcfc8e88
Notes:
github-actions[bot]
2025-01-12 18:40:27 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/dfdcfc8e884 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3233 Reviewed-by: https://github.com/tcl3 ✅
@@ -326,7 +326,7 @@ JS::ThrowCompletionOr<void> CustomElementRegistry::define(String const& name, We
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-get
|
||||
Variant<GC::Root<WebIDL::CallbackType>, JS::Value> CustomElementRegistry::get(String const& name) const
|
||||
Variant<GC::Root<WebIDL::CallbackType>, Empty> CustomElementRegistry::get(String const& name) const
|
||||
{
|
||||
// 1. If this's custom element definition set contains an item with name name, then return that item's constructor.
|
||||
auto existing_definition_iterator = m_custom_element_definitions.find_if([&name](auto const& definition) {
|
||||
@@ -337,7 +337,7 @@ Variant<GC::Root<WebIDL::CallbackType>, JS::Value> CustomElementRegistry::get(St
|
||||
return GC::make_root((*existing_definition_iterator)->constructor());
|
||||
|
||||
// 2. Return undefined.
|
||||
return JS::js_undefined();
|
||||
return Empty {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-getname
|
||||
|
||||
Reference in New Issue
Block a user