Skip to content

Commit

Permalink
Handle setting selectionStart to be > selectionEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Nov 25, 2017
1 parent 95a7e09 commit 9b06cb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 10 additions & 1 deletion components/script/dom/textcontrol.rs
Expand Up @@ -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
Expand Down

This file was deleted.

0 comments on commit 9b06cb3

Please sign in to comment.