Firefox triple click selection returns incorrect start and end offsets
I have this piece of code which is supposed to return the start and end offsets of the user selection: <!DOCTYPE html> <html> <head> <script type="text/javascript"> function getSelRange() { var selObj = window.getSelection(); var range = selObj.getRangeAt(0); alert(range.startOffset+"-"+range.endOffset); } </script> </head> <body> <button onclick="getSelRange()">Get the selected text!</button> <p>Select some text!</p> </body> </html> When I select some text from the p by dragging, it alerts the numbers correctly. However, when I select the entire text in the p by triple clicking on it, it