1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibWeb: Add input and textarea minlength and maxlength support

This commit is contained in:
Bastiaan van der Plaat 2024-03-01 08:49:04 +01:00 committed by Tim Flynn
parent 9b645d20b9
commit a2f101c10b
15 changed files with 162 additions and 5 deletions

View file

@ -92,4 +92,11 @@ Optional<double> parse_floating_point_number(StringView string)
return maybe_double.value();
}
WebIDL::ExceptionOr<String> convert_non_negative_integer_to_string(JS::Realm& realm, WebIDL::Long value)
{
if (value < 0)
return WebIDL::IndexSizeError::create(realm, "The attribute is limited to only non-negative numbers"_fly_string);
return MUST(String::number(value));
}
}