Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[WIP] Finish implementation of HTML5 form validation. #17657
Conversation
highfive
commented
Jul 11, 2017
|
Heads up! This PR modifies the following files: |
highfive
commented
Jul 11, 2017
|
|
|
This is just a prelimiary review and I'm only highlighting things that really jumped out to me. The most surprising part here is the validation logic. I had expected that most of the validation logic to be self-contained in |
| @@ -1188,7 +1191,63 @@ impl Validatable for HTMLInputElement { | |||
| true | |||
| } | |||
| fn validate(&self, _validate_flags: ValidationFlags) -> bool { | |||
This comment has been minimized.
This comment has been minimized.
| use dom::validitystate::*; | ||
|
|
||
| let value = self.Value(); | ||
| let value_str: &str = value.borrow(); |
This comment has been minimized.
This comment has been minimized.
|
@gpoesia Are you still working on this? |
|
|
|
Closing due to inactivity. |
gpoesia commentedJul 11, 2017
•
edited
This is still work in progress, but comments would be highly appreciated.
Some questions:
1- The standard doesn't mention date and telephone validation (I checked which sections refer to the "type mismatch" validity state, and only URL and Email were there). That's why I left it out, but the last PR (#10843) had some validation for them. Should I bring it back?
2- In URL validation, I've checked whether there is either a '.' or a '/' (since for instance http://localhost is a valid URL). Is that fine?
3- For emails, I've only checked whether there is an '@' in the text. However, there's a suggested regex in the standard. Should we use it?
4- In the 'pattern mismatch' error, how do I use JavaScript's Regex engine? I'm guessing the
regexcrate might differ.5- How do I handle 'multiple' inputs? Since there's only one value in an input element, I'm not sure how multiple inputs should be validated.
6- What does
/tests/html/form_html5_validations.htmlactually test? Or is it simply a page for manual testing?TODO:
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is