Handle setting selectionStart to be > selectionEnd

This commit is contained in:
Jon Leighton 2017-11-25 09:49:37 +01:00
parent 95a7e09b40
commit 9b06cb3369
2 changed files with 10 additions and 6 deletions

View file

@ -21,7 +21,16 @@ pub trait TextControl: DerivedFrom<EventTarget> + DerivedFrom<Node> {
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionstart
fn set_dom_selection_start(&self, start: u32) {
self.set_selection_range(start, self.dom_selection_end(), self.selection_direction());
// Step 2
let mut end = self.dom_selection_end();
// Step 3
if end < start {
end = start;
}
// Step 4
self.set_selection_range(start, end, self.selection_direction());
}
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionend

View file

@ -1,5 +0,0 @@
[selection-start-end.html]
type: testharness
[Setting selectionStart to a value larger than selectionEnd should increase selectionEnd]
expected: FAIL