mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-18 23:12:02 +00:00
LibWeb: Implement 'no-validate state' concept
This commit is contained in:
parent
edfae02680
commit
8ca956e6f1
Notes:
github-actions[bot]
2025-07-07 19:15:00 +00:00
Author: https://github.com/edvwib 🔰
Commit: 8ca956e6f1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4592
Reviewed-by: https://github.com/tcl3
7 changed files with 109 additions and 5 deletions
|
@ -350,6 +350,27 @@ bool FormAssociatedElement::satisfies_its_constraints() const
|
|||
suffering_from_being_missing() || suffering_from_a_type_mismatch() || suffering_from_a_pattern_mismatch() || suffering_from_being_too_long() || suffering_from_being_too_short() || suffering_from_an_underflow() || suffering_from_an_overflow() || suffering_from_a_step_mismatch() || suffering_from_bad_input() || suffering_from_a_custom_error());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fs-novalidate
|
||||
bool FormAssociatedElement::novalidate_state() const
|
||||
{
|
||||
// The no-validate state of an element is true if the element is a submit button ...
|
||||
if (!is_submit_button())
|
||||
return false;
|
||||
|
||||
// ..., and the element's formnovalidate attribute is present, ...
|
||||
auto const& html_element = form_associated_element_to_html_element();
|
||||
if (html_element.has_attribute(HTML::AttributeNames::formnovalidate))
|
||||
return true;
|
||||
|
||||
// ... or if the element's form owner's novalidate attribute is present, ...
|
||||
auto* form = this->form();
|
||||
if (form && form->has_attribute(HTML::AttributeNames::novalidate))
|
||||
return true;
|
||||
|
||||
// ... and false otherwise.
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#limiting-user-input-length%3A-the-maxlength-attribute%3Asuffering-from-being-too-long
|
||||
bool FormAssociatedElement::suffering_from_being_too_long() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue