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

@ -217,7 +217,13 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
make_setter!(SetAction, "action");
// https://html.spec.whatwg.org/multipage/#dom-form-autocomplete
make_enumerated_getter!(Autocomplete, "autocomplete", "on", "off");
make_enumerated_getter!(
Autocomplete,
"autocomplete",
"on" | "off",
missing => "on",
invalid => "on"
);
// https://html.spec.whatwg.org/multipage/#dom-form-autocomplete
make_setter!(SetAutocomplete, "autocomplete");
@ -226,8 +232,9 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
make_enumerated_getter!(
Enctype,
"enctype",
"application/x-www-form-urlencoded",
"text/plain" | "multipart/form-data"
"application/x-www-form-urlencoded" | "text/plain" | "multipart/form-data",
missing => "application/x-www-form-urlencoded",
invalid => "application/x-www-form-urlencoded"
);
// https://html.spec.whatwg.org/multipage/#dom-fs-enctype
@ -244,7 +251,13 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
}
// https://html.spec.whatwg.org/multipage/#dom-fs-method
make_enumerated_getter!(Method, "method", "get", "post" | "dialog");
make_enumerated_getter!(
Method,
"method",
"get" | "post" | "dialog",
missing => "get",
invalid => "get"
);
// https://html.spec.whatwg.org/multipage/#dom-fs-method
make_setter!(SetMethod, "method");