[web] Empty Selection/Range object in Opera

Started by
2 comments, last by ForD 15 years, 8 months ago
For certain reasons, I need to know the index of an empty selection of an html element, I can do this fine in firefox and ie, however, Opera always reports the begin and end index of the selection as 0 if the selection is empty. Does anyone know of a way around this?
Advertisement
Check your call to window.getSelection().rangeCount. It seems Opera denies the existence of empty selections and returns 0 for window.getSelection().rangeCount. My solution: Ditch support for Opera until they support standards for 100%, not 99%.
Quote:Original post by kanzler
Check your call to window.getSelection().rangeCount. It seems Opera denies the existence of empty selections and returns 0 for window.getSelection().rangeCount. My solution: Ditch support for Opera until they support standards for 100%, not 99%.

I might do this, but I'd rather not. Mainly because I use Opera as my primary browser. Any other suggestions?

I was thinking maybe I could find the index of the selection based on the pixel cooridnates of the mouse, but I'm not really sure how to go about implementing it.
So I guess there's no work around/fix to this?

This topic is closed to new replies.

Advertisement