Extract common text control selection code

The API for text control selection is the same for both <input> and
<textarea>:

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#textFieldSelection

Before this change, they had similar but not identical implementations
with duplicate code. Now there is a common TextControl trait which
contains the implementation used by both. As a result, some previously
failing tests now pass.
This commit is contained in:
Jon Leighton 2017-11-17 21:34:35 +01:00
parent f290cacccd
commit 6beda3c761
5 changed files with 124 additions and 97 deletions

View file

@ -1,6 +1,5 @@
[selection-start-end.html]
type: testharness
expected: TIMEOUT
[Setting selectionStart to a value larger than selectionEnd should increase selectionEnd]
expected: FAIL
@ -22,30 +21,6 @@
[Initial .value set on textarea-not-appended-prefocused should set selectionStart to end of value]
expected: FAIL
[onselect should fire when selectionStart is changed on textarea-appended]
expected: NOTRUN
[onselect should fire when selectionStart is changed on textarea-not-appended]
expected: NOTRUN
[onselect should fire when selectionStart is changed on textarea-appended-prefocused]
expected: NOTRUN
[onselect should fire when selectionStart is changed on textarea-not-appended-prefocused]
expected: NOTRUN
[onselect should fire when selectionEnd is changed on textarea-appended]
expected: NOTRUN
[onselect should fire when selectionEnd is changed on textarea-not-appended]
expected: NOTRUN
[onselect should fire when selectionEnd is changed on textarea-appended-prefocused]
expected: NOTRUN
[onselect should fire when selectionEnd is changed on textarea-not-appended-prefocused]
expected: NOTRUN
[Initial .value set on textarea-appended should set selectionEnd to end of value]
expected: FAIL