LibWeb: Stub InputEvent.getTargetRanges()

We need this, because https://www.slatejs.org/ that is used by Discord
checks this function to decide whether a browser has "beforeinput" event
support.

(cherry picked from commit 3e8b2454fbcb80891b902ef725dd9549f8880233)
This commit is contained in:
Aliaksandr Kalenik 2024-10-20 21:54:55 +02:00 committed by Nico Weber
parent 647bfd63a5
commit e0cc97d2a9
3 changed files with 12 additions and 0 deletions

View file

@ -43,4 +43,10 @@ void InputEvent::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(InputEvent);
}
Vector<DOM::StaticRange> InputEvent::get_target_ranges() const
{
dbgln("FIXME: Implement InputEvent::get_target_ranges()");
return {};
}
}

View file

@ -6,6 +6,7 @@
#pragma once
#include <LibWeb/DOM/StaticRange.h>
#include <LibWeb/UIEvents/UIEvent.h>
namespace Web::UIEvents {
@ -35,6 +36,8 @@ public:
// https://w3c.github.io/uievents/#dom-inputevent-inputtype
FlyString input_type() const { return m_input_type; }
Vector<DOM::StaticRange> get_target_ranges() const;
private:
InputEvent(JS::Realm&, FlyString const& event_name, InputEventInit const&);

View file

@ -1,4 +1,5 @@
#import <UIEvents/UIEvent.idl>
#import <DOM/StaticRange.idl>
// https://w3c.github.io/uievents/#inputevent
[Exposed=Window]
@ -7,6 +8,8 @@ interface InputEvent : UIEvent {
readonly attribute USVString? data;
readonly attribute boolean isComposing;
readonly attribute DOMString inputType;
sequence<StaticRange> getTargetRanges();
};
// https://w3c.github.io/uievents/#dictdef-inputeventinit