yuntaozhu / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

InputHandler with space as separator inserts two spaces #634

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. Define an AutoComplete widget whose input handler has ' ' as a separator, 
and whose results are the list of Tom Cruise films from 
http://closure-library.googlecode.com/git/closure/goog/demos/autocomplete-basic.
html (Note: I have set up a JSFiddle showing this problem at 
http://jsfiddle.net/E62Ah/1/)
2. Type the beginning of some text, ie. 'd'
3. Click the first result that pops up, ie. 'Days of Thunder'

What is the expected output? The input contains the text 'Days of Thunder ' 
(note the one space following)

What do you see instead? The input contains the text 'Days of Thunder  ' (note 
two spaces following)

What version of the product are you using?
I am using the latest HEAD version 
(http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js)

The problem here seems to be that the separator is first appended, then a space 
is appended. This works fine if the separator is eg. a comma, but is wrong if 
the separator is a space.

Original issue reported on code.google.com by joelcross@google.com on 27 Mar 2014 at 11:43