[html5] Select API for inputs of type numer and email.
binderbound at hotmail.com
Wed Mar 5 16:16:48 PST 2014
I completely disagree. The idea that the API doesn't apply because we don't know what is being selected is complete garbage.
The select API should be available as a character array or set of indexes selected, and the programmer should be able to interpret what that means. There are many applications that are made much easier to implement with the select API. These examples spring to mind:
web apps where you want to override/change the right-click context menu, but still have the option to "copy" within it. How would you know what to copy? (Hang on- doesn't Google do this with google docs?)
A web-based email client, selecting a username from a list of users you are sending to in the "to" field gives you more details about that person.Highlighting an area of the input that fails validation on form submission.web-based find next using regex searching
I agree that you could run into troubles where you don't know whether or not the user is selecting an image within a paragraph could cause issues, but for the input element of type text or textarea, the select API should definately be available.
> Date: Wed, 5 Mar 2014 04:01:13 +0000
> From: ian at hixie.ch
> To: kevinsheedy at gmail.com
> CC: help at whatwg.org
> Subject: Re: [html5] Select API for inputs of type numer and email.
> On Thu, 27 Feb 2014, Kevin Sheedy wrote:
> > The Chrome browser recently disabled the *select api* for inputs of type
> > number and email:
> > https://codereview.chromium.org/100433008/#ps60001
> > The select api is a collection of attributes and functions that allow us to
> > get and set which portion of text a user has highlighted in an <input>
> > The attributes and functions in question are:
> > select()
> > selectionStart
> > selectionEnd
> > selectionDirection
> > setRangeText()
> > setSelectionRange()
> > This change caused bugs in several libraries:
> > http://stackoverflow.com/questions/21177489/selectionstart-selectionend-on-input-type-number-no-longer-allowed-in-chrome#
> > https://github.com/KevinSheedy/jquery.alphanum/issues/19
> > The spec says that these properties should be available for inputs of
> > types* text, search, url, telephone and password* but not for inputs of
> > type *number or email.*
> > I'd like to request that this collection also be made available to
> > inputs of type number and email.
> > Does anyone have any insight as to why these types were excluded?
> There's been some discussion of this here:
> The short answer is that the selection APIs don't apply here because
> there's no way to know what you're going to be selecting. If the value is
> "123456", and you select characters 1 through 4, what is selected?
> Is it "1[23,4]56" ? (square brackets showing selection)
> Is it "O[ne h]undred and twenty three thousand, four hundred and fifty
> Is it "0[00'1]23'456" ?
> Is it "1[.234]56e5" ?
> All of these are valid things for the browser to be showing in a numeric
> field. Indeed, the browser could also show them as even more elaborate
> controls, say as:
> [+] ..... ..... ..... ..... ..... ..... .....
> | | | 0 | | 1 | | 2 | | 3 | | 4 | | 5 |
> >> | | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | <<
> | | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 |
> ''''' ''''' ''''' ''''' ''''' ''''' ''''' [.]
> ...or as:
> 0 100k 200k
> How would you select anything there?
> This is why the API doesn't apply.
> So far, the use cases revolve mostly around doing things that shouldn't be
> necessary, like doing a fake JS-based keyboard for kiosks, instead of
> using native kiosk soft-keyboards provided by the OS. These really aren't
> use cases that make sense for the Web -- the whole point of the Web's
> design is that if you want a special input mode, like a software keyboard,
> you provide that at the user agent (browser) level, not in the page.
> Ian Hickson U+1047E )\._.,--....,'``. fL
> http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
> Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
> Help mailing list
> Help at lists.whatwg.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Help