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
Changes from all commits
File filter...
Jump to…
implement valid Date time Local input
- Loading branch information
| @@ -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 | ||
|
|
Nit:
Can it be indented like following?
Oh, @KiChjang has approved. I think this is not a big issue :P