mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Give Element a CustomStateSet, exposed by ElementInternals
This commit is contained in:
parent
e63d81b36e
commit
b6ffea8990
Notes:
github-actions[bot]
2025-07-04 17:11:47 +00:00
Author: https://github.com/AtkinsSJ
Commit: b6ffea8990
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5302
Reviewed-by: https://github.com/tcl3 ✅
10 changed files with 209 additions and 1 deletions
|
@ -208,6 +208,13 @@ WebIDL::ExceptionOr<GC::Ptr<DOM::NodeList>> ElementInternals::labels()
|
|||
return WebIDL::NotSupportedError::create(realm(), "FIXME: ElementInternals::labels()"_string);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-elementinternals-states
|
||||
GC::Ptr<CustomStateSet> ElementInternals::states()
|
||||
{
|
||||
// The states getter steps are to return this's target element's states set.
|
||||
return m_target_element->ensure_custom_state_set();
|
||||
}
|
||||
|
||||
void ElementInternals::initialize(JS::Realm& realm)
|
||||
{
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(ElementInternals);
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
WebIDL::ExceptionOr<bool> report_validity() const;
|
||||
|
||||
WebIDL::ExceptionOr<GC::Ptr<DOM::NodeList>> labels();
|
||||
GC::Ptr<CustomStateSet> states();
|
||||
|
||||
private:
|
||||
explicit ElementInternals(JS::Realm&, HTMLElement& target_element);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import <DOM/ShadowRoot.idl>
|
||||
#import <HTML/CustomElements/CustomStateSet.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#elementinternals
|
||||
[Exposed=Window]
|
||||
|
@ -24,7 +25,7 @@ interface ElementInternals {
|
|||
readonly attribute NodeList labels;
|
||||
|
||||
// Custom state pseudo-class
|
||||
[FIXME, SameObject] readonly attribute CustomStateSet states;
|
||||
[SameObject] readonly attribute CustomStateSet states;
|
||||
};
|
||||
|
||||
// Accessibility semantics
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue