LibWeb: Implement ShadowRoot.onslotchange

This commit is contained in:
Jamie Mansfield 2024-05-02 00:01:22 +01:00 committed by Andrew Kaster
parent da0ca2f866
commit 1b043d259a
Notes: sideshowbarker 2024-07-17 09:56:35 +09:00
3 changed files with 16 additions and 1 deletions

View File

@ -36,6 +36,18 @@ void ShadowRoot::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(ShadowRoot); WEB_SET_PROTOTYPE_FOR_INTERFACE(ShadowRoot);
} }
// https://dom.spec.whatwg.org/#dom-shadowroot-onslotchange
void ShadowRoot::set_onslotchange(WebIDL::CallbackType* event_handler)
{
set_event_handler_attribute(HTML::EventNames::slotchange, event_handler);
}
// https://dom.spec.whatwg.org/#dom-shadowroot-onslotchange
WebIDL::CallbackType* ShadowRoot::onslotchange()
{
return event_handler_attribute(HTML::EventNames::slotchange);
}
// https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6 // https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6
EventTarget* ShadowRoot::get_parent(Event const& event) EventTarget* ShadowRoot::get_parent(Event const& event)
{ {

View File

@ -25,6 +25,9 @@ public:
bool delegates_focus() const { return m_delegates_focus; } bool delegates_focus() const { return m_delegates_focus; }
void set_delegates_focus(bool delegates_focus) { m_delegates_focus = delegates_focus; } void set_delegates_focus(bool delegates_focus) { m_delegates_focus = delegates_focus; }
void set_onslotchange(WebIDL::CallbackType*);
WebIDL::CallbackType* onslotchange();
bool available_to_element_internals() const { return m_available_to_element_internals; } bool available_to_element_internals() const { return m_available_to_element_internals; }
void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; } void set_available_to_element_internals(bool available_to_element_internals) { m_available_to_element_internals = available_to_element_internals; }

View File

@ -9,7 +9,7 @@ interface ShadowRoot : DocumentFragment {
readonly attribute boolean delegatesFocus; readonly attribute boolean delegatesFocus;
readonly attribute SlotAssignmentMode slotAssignment; readonly attribute SlotAssignmentMode slotAssignment;
readonly attribute Element host; readonly attribute Element host;
// FIXME: attribute EventHandler onslotchange; attribute EventHandler onslotchange;
}; };
ShadowRoot includes InnerHTML; ShadowRoot includes InnerHTML;