I have a "mouseup" event handler inside a contenteditable to check wether text has been selected or not. If you highlight text after typing, all is good, but if you click again (to deselect text) the console shows that range.toString()
is the same despite no text being selected.
http://jsfiddle.net/xpvt214o/857876/
type something in the contenteditable, then select it, then click again (to deselect) and check the console. Both console.logs
will be the same.
I need to differentiate between a real selection and a deselection. If this is normal behavior, how can I tell the two events apart, or how can I do it differently to prevent this behavior?