Implement form-associated custom elements and their ElementInternals (#31980)

* FACEs work, setFormValue test is awful so now has _mozilla backup

* 1. Impl Validatable in ElementInternals instead of HTMLElement. 2. Reuse the code in Validatable trait. 3. The form associated custom element is not a customized built-in element.

* add some comments

* support readonly attribute and complete barred from constraint validation

* Addressed the code review comments

* Updated the legacy-layout results

* Fixed the WPT failures in ElementInternals-validation.html

* Addressed the code review comments

* Review suggestions

* Fixed silly mistakes and update the test result outside elementinternals

* update the test results

---------

Co-authored-by: Patrick Shaughnessy <pshaughn@comcast.net>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
cathiechen 2024-04-11 15:17:11 +02:00 committed by GitHub
parent 2eb959a159
commit 4e4a4c0a28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 1641 additions and 619 deletions

View file

@ -1,33 +1,3 @@
[CustomElementRegistry.html]
[customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present]
expected: FAIL
[customElements.define must rethrow an exception thrown while getting formAssociated on the constructor prototype]
expected: FAIL
[customElements.define must rethrow an exception thrown while getting additional formAssociated callbacks on the constructor prototype]
expected: FAIL
[customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on disabledFeatures]
expected: FAIL
[customElements.define must upgrade elements in the shadow-including tree order]
expected: FAIL
[customElements.define must get four additional callbacks on the prototype if formAssociated is converted to true]
expected: FAIL
[customElements.define must rethrow an exception thrown while getting disabledFeatures on the constructor prototype]
expected: FAIL
[customElements.define must rethrow an exception thrown while iterating over disabledFeatures to sequence<DOMString>]
expected: FAIL
[customElements.define must get "prototype", "disabledFeatures", and "formAssociated" property of the constructor]
expected: FAIL
[customElements.define must rethrow an exception thrown while converting the value of disabledFeatures to sequence<DOMString>]
expected: FAIL
[customElements.define must not throw when defining another custom element in a different global object during Get(constructor, "prototype")]
expected: FAIL

View file

@ -1,2 +1,144 @@
[ElementInternals-accessibility.html]
expected: ERROR
[ElementInternals-accessibility]
expected: FAIL
[ariaDescribedByElements is defined in ElementInternals]
expected: FAIL
[ariaFlowToElements is defined in ElementInternals]
expected: FAIL
[role is defined in ElementInternals]
expected: FAIL
[ariaPosInSet is defined in ElementInternals]
expected: FAIL
[ariaValueMax is defined in ElementInternals]
expected: FAIL
[ariaDisabled is defined in ElementInternals]
expected: FAIL
[ariaRoleDescription is defined in ElementInternals]
expected: FAIL
[ariaValueMin is defined in ElementInternals]
expected: FAIL
[ariaOrientation is defined in ElementInternals]
expected: FAIL
[ariaLabel is defined in ElementInternals]
expected: FAIL
[ariaMultiSelectable is defined in ElementInternals]
expected: FAIL
[ariaExpanded is defined in ElementInternals]
expected: FAIL
[ariaDetailsElements is defined in ElementInternals]
expected: FAIL
[ariaColIndex is defined in ElementInternals]
expected: FAIL
[ariaRowCount is defined in ElementInternals]
expected: FAIL
[ariaBusy is defined in ElementInternals]
expected: FAIL
[ariaChecked is defined in ElementInternals]
expected: FAIL
[ariaControlsElements is defined in ElementInternals]
expected: FAIL
[ariaAutoComplete is defined in ElementInternals]
expected: FAIL
[ariaHasPopup is defined in ElementInternals]
expected: FAIL
[ariaLevel is defined in ElementInternals]
expected: FAIL
[ariaAtomic is defined in ElementInternals]
expected: FAIL
[ariaErrorMessageElement is defined in ElementInternals]
expected: FAIL
[ariaHidden is defined in ElementInternals]
expected: FAIL
[ariaSort is defined in ElementInternals]
expected: FAIL
[ariaRowSpan is defined in ElementInternals]
expected: FAIL
[ariaRowIndex is defined in ElementInternals]
expected: FAIL
[ariaPlaceholder is defined in ElementInternals]
expected: FAIL
[ariaReadOnly is defined in ElementInternals]
expected: FAIL
[ariaOwnsElements is defined in ElementInternals]
expected: FAIL
[ariaActiveDescendantElement is defined in ElementInternals]
expected: FAIL
[ariaColCount is defined in ElementInternals]
expected: FAIL
[ariaRelevant is defined in ElementInternals]
expected: FAIL
[ariaLive is defined in ElementInternals]
expected: FAIL
[ariaValueNow is defined in ElementInternals]
expected: FAIL
[ariaRequired is defined in ElementInternals]
expected: FAIL
[ariaValueText is defined in ElementInternals]
expected: FAIL
[ariaLabelledByElements is defined in ElementInternals]
expected: FAIL
[ariaColSpan is defined in ElementInternals]
expected: FAIL
[ariaModal is defined in ElementInternals]
expected: FAIL
[ariaSelected is defined in ElementInternals]
expected: FAIL
[ariaKeyShortcuts is defined in ElementInternals]
expected: FAIL
[ariaCurrent is defined in ElementInternals]
expected: FAIL
[ariaMultiLine is defined in ElementInternals]
expected: FAIL
[ariaPressed is defined in ElementInternals]
expected: FAIL
[ariaErrorMessageElements is defined in ElementInternals]
expected: FAIL
[ariaInvalid is defined in ElementInternals]
expected: FAIL

View file

@ -1,12 +0,0 @@
[HTMLElement-attachInternals.html]
[Successful attachInternals() and the second call.]
expected: FAIL
[attachInternals() throws a NotSupportedError if it is called for a customized built-in element]
expected: FAIL
[If a custom element definition for the local name of the element doesn't exist, throw an NotSupportedError]
expected: FAIL
[If a custom element definition for the local name of the element has disable internals flag, throw a NotSupportedError]
expected: FAIL

View file

@ -1,2 +1,3 @@
[element-internals-aria-element-reflection.html]
expected: ERROR
[Getting previously-unset ARIA element reflection properties on ElementInternals should return null.]
expected: FAIL

View file

@ -12,11 +12,5 @@
[ElementInternals *can* be called after constructor, upgrade case]
expected: FAIL
[ElementInternals cannot be called after constructor calls it, create case]
expected: FAIL
[ElementInternals disabled by disabledFeatures]
expected: FAIL
[ElementInternals.shadowRoot doesn't reveal pre-attached closed shadowRoot]
expected: FAIL

View file

@ -1,3 +0,0 @@
[ElementInternals-NotSupportedError.html]
[Form-related operations and attributes should throw NotSupportedErrors for non-form-associated custom elements.]
expected: FAIL

View file

@ -1,2 +0,0 @@
[ElementInternals-form.html]
expected: ERROR

View file

@ -1,10 +0,0 @@
[ElementInternals-labels.html]
expected: ERROR
[LABEL association]
expected: FAIL
[LABEL click]
expected: FAIL
[ElementInternals.labels should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL

View file

@ -1,2 +0,0 @@
[ElementInternals-setFormValue-nullish-value.html]
expected: ERROR

View file

@ -1,5 +1,4 @@
[ElementInternals-setFormValue.html]
expected: ERROR
[Newline normalization - \\n\\r in value]
expected: FAIL
@ -221,6 +220,3 @@
[Newline normalization - \\n\\r in FormData filename (formdata)]
expected: FAIL
[ElementInternals.setFormValue() should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL

View file

@ -1,37 +1,6 @@
[ElementInternals-validation.html]
expected: ERROR
[willValidate]
expected: FAIL
[willValidate after upgrade]
expected: FAIL
[willValidate should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL
[validity and setValidity()]
expected: FAIL
["anchor" argument of setValidity()]
expected: FAIL
[checkValidity() should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL
[checkValidity()]
expected: FAIL
[reportValidity() should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL
[reportValidity()]
expected: FAIL
[Custom control affects validation at the owner form]
expected: FAIL
[Custom control affects :valid :invalid for FORM and FIELDSET]
expected: FAIL
[willValidate after upgrade (document.createElement)]
expected: FAIL

View file

@ -1,3 +0,0 @@
[fieldset-elements.html]
[Form associated custom elements should work with fieldset.elements]
expected: FAIL

View file

@ -1,3 +0,0 @@
[focusability.html]
[Focusability of form-associated custom elements]
expected: FAIL

View file

@ -1,2 +1,3 @@
[form-associated-callback.html]
expected: ERROR
[Updating "id" attribute of form element]
expected: FAIL

View file

@ -1,28 +1,3 @@
[form-disabled-callback.html]
expected: ERROR
[Adding/removing disabled content attribute]
expected: FAIL
[Relationship with FIELDSET]
expected: FAIL
[A disabled form-associated custom element should not submit an entry for it]
expected: FAIL
[Disabled attribute affects focus-capability]
expected: FAIL
[Upgrading an element with disabled content attribute]
expected: FAIL
[Toggling "disabled" attribute on a custom element inside disabled <fieldset> does not trigger a callback]
expected: FAIL
[Toggling "disabled" attribute on a <fieldset> does not trigger a callback on disabled custom element descendant]
expected: FAIL
[Callback triggered during a clone/append operation, with disabled state provided by ancestor]
expected: FAIL
[Callback triggered during a clone operation, with disabled state provided by ancestor]
expected: FAIL

View file

@ -1,9 +0,0 @@
[form-elements-namedItem.html]
[Form associated custom elements should work with document.forms.elements.namedItem()]
expected: FAIL
[Form associated custom elements should work with document.forms.elements.namedItem() after upgrading]
expected: FAIL
[Form associated custom elements should work with document.forms.elements.namedItem() after updating the name attribute]
expected: FAIL

View file

@ -1,9 +0,0 @@
[form-reset-callback.html]
[form.reset() should trigger formResetCallback]
expected: FAIL
[form.reset(): formResetCallback is called after reset of the last built-in form control and before the next statement.]
expected: FAIL
[Clicking a reset button invokes formResetCallback in a microtask]
expected: FAIL

View file

@ -1,9 +0,0 @@
[HTMLTableElement.html]
[caption on HTMLTableElement must enqueue connectedCallback when inserting a custom element]
expected: FAIL
[tHead on HTMLTableElement must enqueue connectedCallback when inserting a custom element]
expected: FAIL
[tFoot on HTMLTableElement must enqueue connectedCallback when inserting a custom element]
expected: FAIL

View file

@ -1,3 +0,0 @@
[Range.html]
[createContextualFragment on Range must construct a custom element]
expected: FAIL

View file

@ -1,2 +1,3 @@
[custom-state-set-strong-ref.html]
expected: ERROR
[customstateset doesn't crash after GC on detached node]
expected: FAIL

View file

@ -1,2 +1,10 @@
[state-css-selector-nth-of.html]
expected: ERROR
[state selector has influence on nth-of when state is applied]
expected: FAIL
[state selector only applies on given ident]
expected: NOTRUN
[style is invalided on clear()]
expected: NOTRUN

View file

@ -1,2 +1,30 @@
[state-css-selector.html]
expected: ERROR
[state selector has no influence when state is not applied]
expected: FAIL
[state selector has no influence on sibling selectors when not applied]
expected: FAIL
[state selector has influence when state is applied]
expected: FAIL
[state selector influences siblings when state is applied]
expected: FAIL
[state selector influences has() when state is applied]
expected: FAIL
[state selector only applies on given ident]
expected: FAIL
[state selector only applies to siblings on given ident]
expected: FAIL
[state selector only applies to has() on given ident]
expected: FAIL
[states added multiple times counts as one]
expected: FAIL
[style is invalided on clear()]
expected: FAIL