mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
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:
parent
2eb959a159
commit
4e4a4c0a28
67 changed files with 1641 additions and 619 deletions
41
components/script/dom/webidls/ElementInternals.webidl
Normal file
41
components/script/dom/webidls/ElementInternals.webidl
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#elementinternals
|
||||
[Exposed=Window]
|
||||
interface ElementInternals {
|
||||
// Form-associated custom elements
|
||||
|
||||
[Throws] undefined setFormValue((File or USVString or FormData)? value,
|
||||
optional (File or USVString or FormData)? state);
|
||||
|
||||
[Throws] readonly attribute HTMLFormElement? form;
|
||||
|
||||
// flags shouldn't be optional here, #25704
|
||||
[Throws] undefined setValidity(optional ValidityStateFlags flags = {},
|
||||
optional DOMString message,
|
||||
optional HTMLElement anchor);
|
||||
[Throws] readonly attribute boolean willValidate;
|
||||
[Throws] readonly attribute ValidityState validity;
|
||||
[Throws] readonly attribute DOMString validationMessage;
|
||||
[Throws] boolean checkValidity();
|
||||
[Throws] boolean reportValidity();
|
||||
|
||||
[Throws] readonly attribute NodeList labels;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#elementinternals
|
||||
dictionary ValidityStateFlags {
|
||||
boolean valueMissing = false;
|
||||
boolean typeMismatch = false;
|
||||
boolean patternMismatch = false;
|
||||
boolean tooLong = false;
|
||||
boolean tooShort = false;
|
||||
boolean rangeUnderflow = false;
|
||||
boolean rangeOverflow = false;
|
||||
boolean stepMismatch = false;
|
||||
boolean badInput = false;
|
||||
boolean customError = false;
|
||||
};
|
||||
|
|
@ -50,6 +50,8 @@ interface HTMLElement : Element {
|
|||
|
||||
attribute [LegacyNullToEmptyString] DOMString innerText;
|
||||
|
||||
[Throws] ElementInternals attachInternals();
|
||||
|
||||
// command API
|
||||
// readonly attribute DOMString? commandType;
|
||||
// readonly attribute DOMString? commandLabel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue