Ivan,
Based on your dojo example I tried to figure out the reason of this odd behavior. I suspected it depends on which container for wyswig editor you use.
<textarea id="editor" rows="10" cols="30" style="width:100%;height:400px">
</textarea>
<!-- could be div or span -->
If it's <textarea> then highlighting works fine, but if it's <div>/<span> then highlighting does not work (I believe it depends actually do we have iframe inside or not). Any thoughts on that?