jquery-simulate-ext
jquery-simulate-ext copied to clipboard
key-sequence: Problems with cursor position in WebKit browsers when simulating within an iframe
All of a sudden, the WebKit browsers (tested with Chrome) have problems with the cursor position when simulating a key-sequence on an input within in a child iframe.
E.g.: simulating the sequence "foo" and then simulating the sequence "bar" will produce "barfoo" because every simulation is executed at the beginning of the input. Even something like "{selectall}{rightarrow}bar" doesn't help. It still produces "barfoo".
Maybe there was some update on Webkit or Chrome which causes this.
For now, the workaround is to copy the value of the input, select all and then simulate the new sequence completely. For example:
var oldValue = $('#myInput').val(),
suffix = "append-me";
$outer($('#myInput')).simulate('key-sequence', {sequence: '{selectall}'+oldValue+suffix});