This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28225 - Do we really want getting <input type=image>.selectionDirection to throw?
Summary: Do we really want getting <input type=image>.selectionDirection to throw?
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/#textFie...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-16 10:37 UTC by contributor
Modified: 2016-04-06 10:21 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2015-03-16 10:37:39 UTC
Specification: https://html.spec.whatwg.org/multipage/forms.html
Multipage: https://html.spec.whatwg.org/multipage/#textFieldSelection
Complete: https://html.spec.whatwg.org/#textFieldSelection
Referrer: https://html.spec.whatwg.org/multipage/embedded-content.html

Comment:
Do we really want getting <input type=image>.selectionDirection to throw?

[[
For input elements, calling these methods while they don't apply, and getting
or setting these attributes while they don't apply, must throw an
InvalidStateError exception. 
]]

I noticed this because w(<input type=image>) in Live DOM Viewer hits this
exception since it enumerates the attributes and prints the values.

The forms API in general is pretty lenient for this kind of thing, so you can
check an attribute for any control in a collection without first checking that
the control is one where the attribute applies (e.g. type on textarea).

Posted from: 94.234.170.175 by simonp@opera.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36 OPR/28.0.1750.36 (Edition beta)
Comment 1 Ian 'Hixie' Hickson 2015-03-30 23:08:18 UTC
Yeah there's an API subset that's intentionally supported on everything in form.elements. But I'm not sure what it would mean for selectionDirection to work on everything. In particular, I think people would find it weirder that it returned something but didn't match reality on <input type=number>, than if it threw.
Comment 2 Simon Pieters 2015-03-31 14:21:51 UTC
How about making it return null when it does not apply?
Comment 3 Ian 'Hixie' Hickson 2015-04-07 22:33:35 UTC
I guess that could work.
Comment 4 Anne 2016-03-25 13:24:23 UTC
This already works across Firefox and Chrome, do we really want to rock the boat here?
Comment 5 Simon Pieters 2016-04-06 08:46:37 UTC
https://github.com/nwjs/nw.js/issues/2934
https://bugs.webkit.org/show_bug.cgi?id=111476 (tangentially related but changing to null would make this moot)
https://bugzilla.mozilla.org/show_bug.cgi?id=746906
http://stackoverflow.com/questions/13997203/qunit-comparing-hidden-inputs-typeerror-selectiondirection-on-input

It appears that throwing is both surprising and causes problems, so I think would be good to change.
Comment 6 Anne 2016-04-06 08:50:15 UTC
I guess, if we can get implementers on board. Mounir seemed pretty skeptical.
Comment 7 Simon Pieters 2016-04-06 10:21:29 UTC
https://github.com/whatwg/html/pull/1006