mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibWeb: Stub out several methods for ElementInternals
This begins implementation on form-associated custom elements. This fixes a few WPT tests which I'm importing. Co-authored-by: Sam Atkins <sam@ladybird.org>
This commit is contained in:
parent
7c4fd9f624
commit
85842c1739
Notes:
github-actions[bot]
2025-05-21 14:29:13 +00:00
Author: https://github.com/AtkinsSJ
Commit: 85842c1739
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4813
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/tcl3
9 changed files with 300 additions and 10 deletions
|
@ -833,6 +833,15 @@ void HTMLElement::click()
|
|||
m_click_in_progress = false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-element
|
||||
bool HTMLElement::is_form_associated_custom_element()
|
||||
{
|
||||
// An autonomous custom element is called a form-associated custom element if the element is associated with a
|
||||
// custom element definition whose form-associated field is set to true.
|
||||
auto definition = document().lookup_custom_element_definition(namespace_uri(), local_name(), is_value());
|
||||
return definition->form_associated();
|
||||
}
|
||||
|
||||
Optional<ARIA::Role> HTMLElement::default_role() const
|
||||
{
|
||||
// https://www.w3.org/TR/html-aria/#el-address
|
||||
|
@ -1023,7 +1032,7 @@ WebIDL::ExceptionOr<GC::Ref<ElementInternals>> HTMLElement::attach_internals()
|
|||
{
|
||||
// 1. If this's is value is not null, then throw a "NotSupportedError" DOMException.
|
||||
if (is_value().has_value())
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to a customized build-in element"_string);
|
||||
return WebIDL::NotSupportedError::create(realm(), "ElementInternals cannot be attached to a customized built-in element"_string);
|
||||
|
||||
// 2. Let definition be the result of looking up a custom element definition given this's node document, its namespace, its local name, and null as the is value.
|
||||
auto definition = document().lookup_custom_element_definition(namespace_uri(), local_name(), is_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue