-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selectionStart/End/Direction on input and textarea should not be nullable #2175
Comments
They do return null:
There are previous bugs on this that changed it from throwing to returning null. Web platform tests were even updated :) |
Oh, so I started by testing textarea, and didn't think about |
Previous changes were in #1006 |
So we have a section "APIs for the text control selections" where there is an IDL fragment that lists some things shared between |
Sorry, I didn't notice that. Would it suffice to append |
Maybe we should just remove the extract? |
Removing SGTM. |
Fixes #2275 by making it do nothing, instead of throwing, when it does not apply. This matches all browsers. In the process, this inlines the "does not apply" behavior (which was previously in a prelude that readers often missed; see e.g. #2175), and makes all the setters, getters, and methods into algorithms with steps instead of just paragraphs.
Fixes #2275 by making it do nothing, instead of throwing, when it does not apply. This matches all browsers. In the process, this inlines the "does not apply" behavior (which was previously in a prelude that readers often missed; see e.g. #2175), and makes all the setters, getters, and methods into algorithms with steps instead of just paragraphs.
Fixes whatwg#2275 by making it do nothing, instead of throwing, when it does not apply. This matches all browsers. In the process, this inlines the "does not apply" behavior (which was previously in a prelude that readers often missed; see e.g. whatwg#2175), and makes all the setters, getters, and methods into algorithms with steps instead of just paragraphs.
https://html.spec.whatwg.org/multipage/forms.html#the-input-element
https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element
For both elements, the spec currently says:
However, the prose never return null:
https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-selectionstart
https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-selectionend
https://html.spec.whatwg.org/multipage/forms.html#dom-textarea/input-selectiondirection
http://codepen.io/anon/pen/VmEgww is a test case for this. Chrome, Edge, Firefox and Safari all return 0 as the intial values for
selectionStart
andselectionEnd
There's some interesting variation for
selectionDirection
, but it's never null.Spec change is trivial, but need to update web-platform-tests.
Found by @LoonyBean while investigating why this is nullable in spec but not in Blink.
The text was updated successfully, but these errors were encountered: