mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Steps 7-9 of the input type change algorithm
Spec: https://html.spec.whatwg.org/multipage/input.html#input-type-change In short, this resets the selection to the start of the field when the type has changed from one which doesn't support the selection API to one that does. I couldn't see an existing WPT test covering this.
This commit is contained in:
parent
ce7bae8834
commit
a8b64aca2a
5 changed files with 40 additions and 7 deletions
|
@ -36,7 +36,7 @@ use std::default::Default;
|
|||
use std::ops::Range;
|
||||
use style::attr::AttrValue;
|
||||
use style::element_state::ElementState;
|
||||
use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
|
||||
use textinput::{Direction, KeyReaction, Lines, SelectionDirection, TextInput};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLTextAreaElement {
|
||||
|
@ -262,7 +262,7 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
|
|||
|
||||
if old_value != textinput.get_content() {
|
||||
// Step 4
|
||||
textinput.clear_selection_to_limit();
|
||||
textinput.clear_selection_to_limit(Direction::Forward);
|
||||
} else {
|
||||
textinput.selection_origin = old_selection;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue