Added time input sanitization:

- Implemented is_valid_time_string for DOMString.
- Use is_valid_time_string for sanitize_value with time input.
- Improved input type change test
This commit is contained in:
Simon Wörner 2017-11-26 15:13:02 +01:00 committed by Simon Wörner
parent ac6e04ebfb
commit a999239f28
8 changed files with 228 additions and 157 deletions

View file

@ -895,6 +895,13 @@ impl HTMLInputElement {
textinput.set_content("#000000".into());
}
}
atom!("time") => {
let mut textinput = self.textinput.borrow_mut();
if ! textinput.single_line_content().is_valid_time_string() {
*textinput.single_line_content_mut() = "".into();
}
}
// TODO: Implement more value sanitization algorithms for different types of inputs
_ => ()
}