Previously, you'd use window.getSelection().toString() for Safari, document.getSelection() for Firefox and document.selection.createRange().text for IE.
In Firefox 3, document.getSelection has been deprecated, so the proper way to get selected text is now aligned with that of Safari:
var text = window.getSelection ? window.getSelection().toString() : (document.selection ? document.selection.createRange().text : "");