Differentiate between missing/invalid value in make_enumerated_getter! (#34412)

* Create spec-compliant version of create_enumerated_getter

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Use new make_enumerated_getter! macro everywhere

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Remove old make_enumerated_getter macro

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Return lowercased value from make_enumerated_getter macro

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2024-11-28 01:54:03 +01:00 committed by GitHub
parent 612492b372
commit 9168375b33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 137 additions and 36 deletions

View file

@ -1399,21 +1399,28 @@ impl HTMLInputElementMethods<crate::DomTypeHolder> for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-formaction
make_setter!(SetFormAction, "formaction");
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
// https://html.spec.whatwg.org/multipage/#dom-fs-formenctype
make_enumerated_getter!(
FormEnctype,
"formenctype",
"application/x-www-form-urlencoded",
"text/plain" | "multipart/form-data"
"application/x-www-form-urlencoded" | "text/plain" | "multipart/form-data",
missing => "",
invalid => "application/x-www-form-urlencoded"
);
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
make_setter!(SetFormEnctype, "formenctype");
// https://html.spec.whatwg.org/multipage/#dom-input-formmethod
make_enumerated_getter!(FormMethod, "formmethod", "get", "post" | "dialog");
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_enumerated_getter!(
FormMethod,
"formmethod",
"get" | "post" | "dialog",
missing => "get",
invalid => "get"
);
// https://html.spec.whatwg.org/multipage/#dom-input-formmethod
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_setter!(SetFormMethod, "formmethod");
// https://html.spec.whatwg.org/multipage/#dom-input-formtarget