title: chrome setSelectionRange() not work in oninput handler
body: <p>I'm working with some auto-completion code. <code>setSelectionRange()</code> is used to select text been completed in <code>oninput</code> event handler. It works at least in Firefox 14, but not in Chrome(6, 17).</p>
  
  <p>Simplified code snippet demonstrating the problem is like this:</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type='text' oninput='select()' /&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>function select(e){
      var s = this.value;
      if (s.length)
          this.setSelectionRange(s.length-1, s.length);
  }
  </code></pre>
  
  <p>I debugged the code in chrome, and it turns out that text has been selected at first right after the <code>setSelectionRange()</code> been executed, but the selection disappeared later.</p>
  
  <p>If i bind the handler to <code>onclick</code> instead of <code>oninput</code>, like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type='text' onclick='select()' /&gt;
  </code></pre>
  
  <p>then both browsers work fine.</p>
  
  <p>Can anyone please give me some clue to make selection work in Chrome?</p>