New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement valid DatetimeLocal input #19602
Merged
+111
−125
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
| @@ -996,19 +996,19 @@ impl HTMLInputElement { | ||
| InputType::Date => { | ||
| let mut textinput = self.textinput.borrow_mut(); | ||
| if !textinput.single_line_content().is_valid_date_string() { | ||
| *textinput.single_line_content_mut() = "".into(); | ||
| textinput.single_line_content_mut().clear(); | ||
| } | ||
| } | ||
| InputType::Month => { | ||
| let mut textinput = self.textinput.borrow_mut(); | ||
| if !textinput.single_line_content().is_valid_month_string() { | ||
| *textinput.single_line_content_mut() = "".into(); | ||
| textinput.single_line_content_mut().clear(); | ||
| } | ||
| } | ||
| InputType::Week => { | ||
| let mut textinput = self.textinput.borrow_mut(); | ||
| if !textinput.single_line_content().is_valid_week_string() { | ||
| *textinput.single_line_content_mut() = "".into(); | ||
| textinput.single_line_content_mut().clear(); | ||
| } | ||
| } | ||
| InputType::Color => { | ||
| @@ -1034,8 +1034,15 @@ impl HTMLInputElement { | ||
| InputType::Time => { | ||
| let mut textinput = self.textinput.borrow_mut(); | ||
|
|
||
| if ! textinput.single_line_content().is_valid_time_string() { | ||
| *textinput.single_line_content_mut() = "".into(); | ||
| if !textinput.single_line_content().is_valid_time_string() { | ||
| textinput.single_line_content_mut().clear(); | ||
| } | ||
| } | ||
| InputType::DatetimeLocal => { | ||
| let mut textinput = self.textinput.borrow_mut(); | ||
| if textinput.single_line_content_mut() | ||
| .convert_valid_normalized_local_date_and_time_string().is_err() { | ||
| textinput.single_line_content_mut().clear(); | ||
KiChjang
Member
|
||
| } | ||
| } | ||
| // TODO: Implement more value sanitization algorithms for different types of inputs | ||
| "testharness" | ||
| ], | ||
| "html/semantics/forms/the-input-element/datetime-local.html": [ | ||
| "7fe3ab2bd5a8d60e11d08460286ee8f02943b769", | ||
| "382370387908b4625474b410621497a76476a0cf", | ||
| "testharness" | ||
| ], | ||
| "html/semantics/forms/the-input-element/datetime.html": [ |
| @@ -1,29 +1,9 @@ | ||
| [datetime-local.html] | ||
| type: testharness | ||
| [datetime-local input value set to 2014-01-01 11:11:11.111 without min/max] | ||
| expected: FAIL | ||
|
|
||
| [datetime-local input value set to 2014-01-01 11:11 without min/max] | ||
| expected: FAIL | ||
|
|
||
| [datetime-local input value set to 2014-01-01 00:00:00.000 without min/max] | ||
| expected: FAIL | ||
|
|
||
| [datetime-local input value set to 2014-01-0 11:11 without min/max] | ||
| expected: FAIL | ||
|
|
||
| [datetime-local input value set to 2014-01-01 11:1 without min/max] | ||
| expected: FAIL | ||
|
|
||
| [Value >= min attribute] | ||
| expected: FAIL | ||
|
|
||
| [Value < min attribute] | ||
| expected: FAIL | ||
|
|
||
| [Value <= max attribute] | ||
| expected: FAIL | ||
|
|
||
| [Value > max attribute] | ||
| expected: FAIL | ||
|
|
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Nit:
Can it be indented like following?
Oh, @KiChjang has approved. I think this is not a big issue :P