TextSelector JavaScript class

TextSelector is a lightweight JavaScript class for handling text selections. It retrieves the highlighted text on the page reliably and independently of the document area and browser.

Which is to say, it will behave properly no matter what browser you are in, and no matter whether you have normal text on the page selected or some input inside a text field highlighted. I found it odd that there was nothing like this out there, so here it is (:
The class is written in pure JavaScript, so you don't need any external dependencies to use it.