mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00: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:
parent
fef1f62ecc
commit
dfdcfc8e88
Notes:
github-actions[bot]
2025-01-12 18:40:27 +00:00
Author: https://github.com/shannonbooth
Commit: dfdcfc8e88
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3233
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 13 additions and 7 deletions
|
@ -1199,12 +1199,12 @@ WebIDL::ExceptionOr<void> Window::post_message(JS::Value message, String const&
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-window-event
|
||||
Variant<GC::Root<DOM::Event>, JS::Value> Window::event() const
|
||||
Variant<GC::Root<DOM::Event>, Empty> Window::event() const
|
||||
{
|
||||
// The event getter steps are to return this’s current event.
|
||||
if (auto* current_event = this->current_event())
|
||||
return make_root(const_cast<DOM::Event&>(*current_event));
|
||||
return JS::js_undefined();
|
||||
return Empty {};
|
||||
}
|
||||
|
||||
// https://w3c.github.io/csswg-drafts/cssom/#dom-window-getcomputedstyle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue