mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix form validation for readonly inputs and update WPT expectations (#36090)
The HTML specification states that an input element with the `readonly` attribute must be barred from constraint validation. Our implementation previously included an extra check (`does_readonly_apply()`) to verify if `readonly` applies to the input type, which is unnecessary. This caused three test failures in: tests/wpt/meta/html/semantics/forms/constraints/form-validation-willValidate.html.ini - Removed `does_readonly_apply()` as it is not required for validation. - Removed `tests/wpt/meta/html/semantics/forms/constraints/form-validation-willValidate.html.ini` since the test now passes. To update the Web Platform Test expectations, see: https://book.servo.org/hacking/testing.html#updating-web-platform-test-expectations Fixes servo/servo#36076 Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com>
This commit is contained in:
parent
7c574141c0
commit
80434d4644
2 changed files with 1 additions and 28 deletions
|
@ -477,24 +477,6 @@ impl HTMLInputElement {
|
|||
textinput.set_content(value);
|
||||
}
|
||||
|
||||
fn does_readonly_apply(&self) -> bool {
|
||||
matches!(
|
||||
self.input_type(),
|
||||
InputType::Text |
|
||||
InputType::Search |
|
||||
InputType::Url |
|
||||
InputType::Tel |
|
||||
InputType::Email |
|
||||
InputType::Password |
|
||||
InputType::Date |
|
||||
InputType::Month |
|
||||
InputType::Week |
|
||||
InputType::Time |
|
||||
InputType::DatetimeLocal |
|
||||
InputType::Number
|
||||
)
|
||||
}
|
||||
|
||||
fn does_minmaxlength_apply(&self) -> bool {
|
||||
matches!(
|
||||
self.input_type(),
|
||||
|
@ -2753,7 +2735,7 @@ impl Validatable for HTMLInputElement {
|
|||
InputType::Hidden | InputType::Button | InputType::Reset => false,
|
||||
_ => {
|
||||
!(self.upcast::<Element>().disabled_state() ||
|
||||
(self.ReadOnly() && self.does_readonly_apply()) ||
|
||||
self.ReadOnly() ||
|
||||
is_barred_by_datalist_ancestor(self.upcast()))
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue