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,4 +1,3 @@
[state-in-has.html]
expected: ERROR
[Test :has() invalidation with :state() pseudo-classes]
expected: FAIL

View file

@ -2,42 +2,3 @@
type: testharness
[customElements.define must upgrade elements in the shadow-including tree order]
expected: FAIL
[customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present]
expected: FAIL
[customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on disabledFeatures]
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 rethrow an exception thrown while converting the value of disabledFeatures to sequence<DOMString>]
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 get four additional callbacks on the prototype if formAssociated is converted to true]
expected: FAIL
[customElements.define must get "prototype", "disabledFeatures", and "formAssociated" property of the constructor]
expected: FAIL
[customElements.define must not throw when defining another custom element in a different global object during Get(constructor, "prototype")]
expected: FAIL
[customElements.getName must return null when the registry does not contain an entry with the given constructor]
expected: FAIL
[customElements.getName returns the name of the entry with the given constructor when there is a matching entry.]
expected: FAIL
[customElements.getName returns the name of the entry with the given customized built in constructor when there is a matching entry.]
expected: FAIL

View file

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

View file

@ -1,16 +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 has disable internals flag, throw a NotSupportedError]
expected: FAIL
[If a custom element definition for the local name of the element doesn't exist, throw an InvalidStateError]
expected: FAIL
[If a custom element definition for the local name of the element doesn't exist, throw an 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

@ -1,8 +1,5 @@
[element-internals-shadowroot.html]
expected: ERROR
[ElementInternals cannot be called after constructor calls it, create case]
expected: FAIL
[ElementInternals cannot be called before constructor, upgrade case]
expected: FAIL
@ -15,8 +12,5 @@
[ElementInternals *can* be called after constructor, upgrade case]
expected: FAIL
[ElementInternals disabled by disabledFeatures]
expected: FAIL
[ElementInternals.shadowRoot doesn't reveal pre-attached closed shadowRoot]
expected: FAIL

View file

@ -1,4 +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 click]
expected: FAIL
[LABEL association]
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
[Single value - Non-empty name exists]
expected: FAIL
@ -219,8 +218,5 @@
[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
[Single value - name is missing]
expected: FAIL

View file

@ -1,37 +1,6 @@
[ElementInternals-validation.html]
expected: ERROR
[validity and setValidity()]
expected: FAIL
[reportValidity()]
expected: FAIL
["anchor" argument of setValidity()]
expected: FAIL
[checkValidity()]
expected: FAIL
[Custom control affects validation at the owner form]
expected: FAIL
[willValidate]
expected: FAIL
[Custom control affects :valid :invalid for FORM and FIELDSET]
expected: FAIL
[willValidate after upgrade]
expected: FAIL
[willValidate should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL
[checkValidity() should throw NotSupportedError if the target element is not a form-associated custom element]
expected: FAIL
[reportValidity() should throw NotSupportedError if the target element is not a form-associated custom element]
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,5 +1,3 @@
[form-associated-callback.html]
expected: ERROR
[formAssociatedCallback, and form IDL attribute of ElementInternals]
[Updating "id" attribute of form element]
expected: FAIL

View file

@ -1,28 +1,3 @@
[form-disabled-callback.html]
expected: ERROR
[Upgrading an element with disabled content attribute]
expected: FAIL
[Disabled attribute affects focus-capability]
expected: FAIL
[Relationship with FIELDSET]
expected: FAIL
[A disabled form-associated custom element should not submit an entry for it]
expected: FAIL
[Adding/removing 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,10 +0,0 @@
[form-reset-callback.html]
[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
[form.reset() should trigger formResetCallback]
expected: FAIL

View file

@ -1,14 +0,0 @@
[HTMLTableElement.html]
type: testharness
[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
[Custom Elements: CEReactions on HTMLTableElement interface]
expected: FAIL

View file

@ -1,5 +0,0 @@
[Range.html]
type: testharness
[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

View file

@ -32,9 +32,6 @@
[OffscreenCanvasRenderingContext2D interface: operation measureText(DOMString)]
expected: FAIL
[ElementInternals interface: existence and properties of interface object]
expected: FAIL
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "imageSmoothingQuality" with the proper type]
expected: FAIL
@ -209,9 +206,6 @@
[OffscreenCanvasRenderingContext2D interface: operation beginPath()]
expected: FAIL
[ElementInternals interface object length]
expected: FAIL
[SVGElement interface: attribute onchange]
expected: FAIL
@ -221,9 +215,6 @@
[CanvasRenderingContext2D interface: operation strokeText(DOMString, unrestricted double, unrestricted double, unrestricted double)]
expected: FAIL
[ElementInternals interface: operation reportValidity()]
expected: FAIL
[SharedWorker interface object name]
expected: FAIL
@ -239,9 +230,6 @@
[OffscreenCanvasRenderingContext2D interface: attribute shadowColor]
expected: FAIL
[ElementInternals interface: operation checkValidity()]
expected: FAIL
[SVGElement interface: attribute tabIndex]
expected: FAIL
@ -650,12 +638,6 @@
[OffscreenCanvasRenderingContext2D interface object name]
expected: FAIL
[ElementInternals interface object name]
expected: FAIL
[ElementInternals interface: attribute labels]
expected: FAIL
[SVGAElement interface: attribute host]
expected: FAIL
@ -689,9 +671,6 @@
[ApplicationCache interface: attribute oncached]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: operation commit()]
expected: FAIL
@ -737,9 +716,6 @@
[SVGSVGElement interface: attribute onrejectionhandled]
expected: FAIL
[ElementInternals interface: attribute form]
expected: FAIL
[ApplicationCache interface: attribute onerror]
expected: FAIL
@ -818,12 +794,6 @@
[OffscreenCanvasRenderingContext2D interface: operation putImageData(ImageData, long, long, long, long, long, long)]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[SharedWorker interface object length]
expected: FAIL
@ -836,9 +806,6 @@
[SVGElement interface: attribute onmouseleave]
expected: FAIL
[ElementInternals interface: attribute willValidate]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: operation moveTo(unrestricted double, unrestricted double)]
expected: FAIL
@ -1187,9 +1154,6 @@
[OffscreenCanvas interface: operation convertToBlob(ImageEncodeOptions)]
expected: FAIL
[ElementInternals interface: attribute validationMessage]
expected: FAIL
[SVGElement interface: attribute onformdata]
expected: FAIL
@ -1220,9 +1184,6 @@
[SVGElement interface: attribute ondrag]
expected: FAIL
[ElementInternals interface: attribute validity]
expected: FAIL
[SVGElement interface: attribute autofocus]
expected: FAIL
@ -1334,9 +1295,6 @@
[OffscreenCanvasRenderingContext2D interface: operation setTransform(optional DOMMatrix2DInit)]
expected: FAIL
[ElementInternals interface: operation setFormValue((File or USVString or FormData)?, optional (File or USVString or FormData)?)]
expected: FAIL
[Navigator interface: operation registerProtocolHandler(DOMString, USVString)]
expected: FAIL
@ -1346,9 +1304,6 @@
[Navigator interface: calling registerProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError]
expected: FAIL
[ElementInternals interface: operation setValidity(optional ValidityStateFlags, optional DOMString, optional HTMLElement)]
expected: FAIL
[ElementInternals interface: attribute shadowRoot]
expected: FAIL
@ -2862,9 +2817,6 @@
[HTMLInputElement interface: createInput("image") must inherit property "useMap" with the proper type]
expected: FAIL
[HTMLElement interface: operation attachInternals()]
expected: FAIL
[HTMLVideoElement interface: attribute playsInline]
expected: FAIL
@ -4050,9 +4002,6 @@
[HTMLMarqueeElement interface: attribute direction]
expected: FAIL
[HTMLElement interface: document.createElement("noscript") must inherit property "attachInternals()" with the proper type]
expected: FAIL
[HTMLFormElement interface: document.createElement("form") must inherit property "requestSubmit(HTMLElement)" with the proper type]
expected: FAIL

View file

@ -563171,7 +563171,7 @@
]
],
"form-associated-callback.html": [
"7feec50fef89103326e404efc2287767ee0981fb",
"329c4d75931896e7e6a2a8e4499b6ff67fc22cab",
[
null,
{}

View file

@ -1,4 +1,3 @@
[state-in-has.html]
expected: ERROR
[Test :has() invalidation with :state() pseudo-classes]
expected: FAIL

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

View file

@ -62,12 +62,6 @@
[SVGElement interface: attribute onended]
expected: FAIL
[ElementInternals interface object length]
expected: FAIL
[ElementInternals interface: operation reportValidity()]
expected: FAIL
[SVGSVGElement interface: attribute onbeforeprint]
expected: FAIL
@ -92,9 +86,6 @@
[OffscreenCanvas interface: operation convertToBlob(optional ImageEncodeOptions)]
expected: FAIL
[ElementInternals interface: operation setValidity(ValidityStateFlags, optional DOMString, optional HTMLElement)]
expected: FAIL
[DOMStringList interface: calling item(unsigned long) on location.ancestorOrigins with too few arguments must throw TypeError]
expected: FAIL
@ -167,9 +158,6 @@
[OffscreenCanvasRenderingContext2D interface: attribute strokeStyle]
expected: FAIL
[ElementInternals interface: attribute labels]
expected: FAIL
[SVGElement interface: attribute oncopy]
expected: FAIL
@ -323,9 +311,6 @@
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getLineDash()" with the proper type]
expected: FAIL
[ElementInternals interface: existence and properties of interface object]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: attribute imageSmoothingEnabled]
expected: FAIL
@ -389,9 +374,6 @@
[Navigator interface: calling unregisterProtocolHandler(DOMString, USVString) on window.navigator with too few arguments must throw TypeError]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[SVGElement interface: attribute ondurationchange]
expected: FAIL
@ -461,9 +443,6 @@
[Path2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double)]
expected: FAIL
[ElementInternals interface: attribute validationMessage]
expected: FAIL
[DataTransfer interface: attribute dropEffect]
expected: FAIL
@ -806,15 +785,9 @@
[DragEvent interface: existence and properties of interface object]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[Path2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean)]
expected: FAIL
[ElementInternals interface: attribute willValidate]
expected: FAIL
[OffscreenCanvas interface object length]
expected: FAIL
@ -851,9 +824,6 @@
[Navigator interface: window.navigator must inherit property "registerProtocolHandler(DOMString, USVString)" with the proper type]
expected: FAIL
[ElementInternals interface: existence and properties of interface prototype object]
expected: FAIL
[OffscreenCanvas interface object name]
expected: FAIL
@ -959,9 +929,6 @@
[SVGSVGElement interface: attribute onmessage]
expected: FAIL
[ElementInternals interface object name]
expected: FAIL
[SVGElement interface: attribute onmouseup]
expected: FAIL
@ -971,9 +938,6 @@
[OffscreenCanvasRenderingContext2D interface: operation isPointInPath(unrestricted double, unrestricted double, optional CanvasFillRule)]
expected: FAIL
[ElementInternals interface: attribute validity]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: operation restore()]
expected: FAIL
@ -983,9 +947,6 @@
[DataTransferItem interface: existence and properties of interface object]
expected: FAIL
[ElementInternals interface: operation checkValidity()]
expected: FAIL
[Location interface: stringifier]
expected: FAIL
@ -1112,9 +1073,6 @@
[SVGSVGElement interface: attribute onrejectionhandled]
expected: FAIL
[ElementInternals interface: attribute form]
expected: FAIL
[SVGElement interface: attribute onratechange]
expected: FAIL
@ -1205,15 +1163,6 @@
[ApplicationCache interface: attribute onobsolete]
expected: FAIL
[ElementInternals interface: operation setFormValue((File or USVString or FormData)?, optional (File or USVString or FormData)?)]
expected: FAIL
[ElementInternals interface: operation setValidity(optional ValidityStateFlags, optional DOMString, optional HTMLElement)]
expected: FAIL
[ElementInternals interface: attribute shadowRoot]
expected: FAIL
[Worklet interface object length]
expected: FAIL
@ -1838,9 +1787,6 @@
[Element interface: operation setHTMLUnsafe(DOMString)]
expected: FAIL
[ElementInternals interface: attribute states]
expected: FAIL
[CustomStateSet interface: existence and properties of interface object]
expected: FAIL
@ -2021,6 +1967,12 @@
[Element interface: operation setHTMLUnsafe(HTMLString)]
expected: FAIL
[ElementInternals interface: attribute shadowRoot]
expected: FAIL
[ElementInternals interface: attribute states]
expected: FAIL
[idlharness.https.html?include=(Document|Window)]
[Document interface: documentWithHandlers must inherit property "queryCommandEnabled(DOMString)" with the proper type]
@ -2718,9 +2670,6 @@
[HTMLInputElement interface: createInput("image") must inherit property "useMap" with the proper type]
expected: FAIL
[HTMLElement interface: operation attachInternals()]
expected: FAIL
[HTMLVideoElement interface: attribute playsInline]
expected: FAIL
@ -3879,9 +3828,6 @@
[HTMLMarqueeElement interface: attribute direction]
expected: FAIL
[HTMLElement interface: document.createElement("noscript") must inherit property "attachInternals()" with the proper type]
expected: FAIL
[HTMLInputElement interface: createInput("radio") must inherit property "width" with the proper type]
expected: FAIL

View file

@ -12615,6 +12615,13 @@
{}
]
],
"ElementInternals-setFormValue.html": [
"d553dd1a90262700323a714359df60906ac057cf",
[
null,
{}
]
],
"Event.html": [
"3947b286122ee47f2f874232763ceeff3c2b661e",
[
@ -13410,7 +13417,7 @@
]
],
"interfaces.html": [
"5461ff50d836f872fdf09defd98575d08fda0061",
"063495d90f464f161c52a8d099a298e914b9b082",
[
null,
{}

View file

@ -0,0 +1,137 @@
<!DOCTYPE html>
<!-- Like custom-elements/form-associated/ElementInternals-setFormValue,
but without any ordering assumptions about iframe loads and promise
microtasks, to test the form submissions despite Servo's racey iframe.
Includes web-platform-tests/wpt#21747 change to initial values. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="container1"></div>
<div id="container2"></div>
<div id="container3"></div>
<div id="container4"></div>
<div id="container5"></div>
<div id="container6"></div>
<script>
class MyControl extends HTMLElement {
static get formAssociated() { return true; }
constructor() {
super();
this.internals_ = this.attachInternals();
this.value_ = '';
}
get value() {
return this.value_;
}
set value(v) {
this.internals_.setFormValue(v);
this.value_ = v;
}
setValues(nameValues) {
const formData = new FormData();
for (let p of nameValues) {
formData.append(p[0], p[1]);
}
this.internals_.setFormValue(formData);
}
}
customElements.define('my-control', MyControl);
const $ = document.querySelector.bind(document);
function submitPromise(t, n) {
return new Promise((resolve, reject) => {
const iframe = $('#container'+n+' iframe');
iframe.onload = () => {
if(iframe.contentWindow.location.href == "about:blank") { return; }
resolve(iframe.contentWindow.location.search);
}
iframe.onerror = () => reject(new Error('iframe onerror fired'));
$('#container'+n+' form').submit();
});
}
promise_test(t => {
$('#container1').innerHTML = '<form action="/common/blank.html" target="if1">' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control></my-control>' +
'</form>' +
'<iframe name="if1"></iframe>';
return submitPromise(t,1).then(query => {
assert_equals(query, '?name-pd1=value-pd1');
});
}, 'Single value - name is missing');
promise_test(t => {
$('#container2').innerHTML = '<form action="/common/blank.html" target="if2">' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control name=""></my-control>' +
'<input name=name-pd2 value="value-pd2">' +
'</form>' +
'<iframe name="if2"></iframe>';
$('#container2 my-control').value = 'value-ce1';
return submitPromise(t,2).then(query => {
assert_equals(query, '?name-pd1=value-pd1&name-pd2=value-pd2');
});
}, 'Single value - empty name exists');
promise_test(t => {
$('#container3').innerHTML = '<form action="/common/blank.html" target="if3" accept-charset=utf-8>' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control name="name-ce1"></my-control>' +
'<my-control name="name-usv"></my-control>' +
'<my-control name="name-file"></my-control>' +
'</form>' +
'<iframe name="if3"></iframe>';
const USV_INPUT = 'abc\uDC00\uD800def';
const USV_OUTPUT = 'abc\uFFFD\uFFFDdef';
const FILE_NAME = 'test_file.txt';
$('#container3 [name=name-usv]').value = USV_INPUT;
$('#container3 [name=name-file]').value = new File(['file content'], FILE_NAME);
return submitPromise(t,3).then(query => {
assert_equals(query, `?name-pd1=value-pd1&name-usv=${encodeURIComponent(USV_OUTPUT)}&name-file=${FILE_NAME}`);
});
}, 'Single value - Non-empty name exists');
promise_test(t => {
$('#container4').innerHTML = '<form action="/common/blank.html" target="if4">' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control name="name-ce1"></my-control>' +
'<my-control name="name-ce2"></my-control>' +
'</form>' +
'<iframe name="if4"></iframe>';
$('#container4 my-control').value = null;
return submitPromise(t,4).then(query => {
assert_equals(query, '?name-pd1=value-pd1');
});
}, 'Null value should submit nothing');
promise_test(t => {
$('#container5').innerHTML = '<form action="/common/blank.html" target="if5">' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control name=name-ce1></my-control>' +
'</form>' +
'<iframe name="if5"></iframe>';
$('#container5 my-control').value = 'value-ce1';
$('#container5 my-control').setValues([]);
$('#container5 my-control').setValues([['sub1', 'subvalue1'],
['sub2', 'subvalue2'],
['sub2', 'subvalue3']]);
return submitPromise(t,5).then(query => {
assert_equals(query, '?name-pd1=value-pd1&sub1=subvalue1&sub2=subvalue2&sub2=subvalue3');
});
}, 'Multiple values - name content attribute is ignored');
promise_test(t => {
$('#container6').innerHTML = '<form action="/common/blank.html" target="if6">' +
'<input name=name-pd1 value="value-pd1">' +
'<my-control name=name-ce1></my-control>' +
'</form>' +
'<iframe name="if6"></iframe>';
$('#container6 my-control').value = 'value-ce1';
$('#container6 my-control').setValues([]);
return submitPromise(t,6).then(query => {
assert_equals(query, '?name-pd1=value-pd1');
});
}, 'setFormValue with an empty FormData should submit nothing');
</script>

View file

@ -77,6 +77,7 @@ test_interfaces([
"DOMStringMap",
"DOMTokenList",
"Element",
"ElementInternals",
"ErrorEvent",
"Event",
"EventSource",

View file

@ -122,7 +122,7 @@ test(() => {
}
}
customElements.define('will-be-defined', WillBeDefined);
customElements.upgrade(container);
customElements.upgrade($('#container'));
controls = $('#form1').elements;
assert_equals(controls.length, 3, 'form.elements.length');