mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Handle setting selectionStart to be > selectionEnd
This commit is contained in:
parent
95a7e09b40
commit
9b06cb3369
2 changed files with 10 additions and 6 deletions
|
@ -21,7 +21,16 @@ pub trait TextControl: DerivedFrom<EventTarget> + DerivedFrom<Node> {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionstart
|
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionstart
|
||||||
fn set_dom_selection_start(&self, start: u32) {
|
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
|
// https://html.spec.whatwg.org/multipage/#dom-textarea/input-selectionend
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[selection-start-end.html]
|
|
||||||
type: testharness
|
|
||||||
[Setting selectionStart to a value larger than selectionEnd should increase selectionEnd]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue