I have this solution see example below. What is your opinion?
<html>
<body>
<textarea cols=50 ondblclick="checkDblClick(event)">abc1space abc2space abc3space abc
</textarea>
<script>
function checkDblClickDelayed(target) {
while (target.value.substr(target.selectionEnd -1, 1) == " ") {
target.selectionEnd = target.selectionEnd - 1;
}
}
function checkDblClick(e) {
//we make a delay of 0ms to wait until the selection is in the final position
target = e.target;
setTimeout(function()
{
checkDblClickDelayed(target);
}
, 0);
}
</script>
</body>
</html>