title: How to get the selected text?
body: <p><s>In Chrome,</s> I can use</p>
  
  <pre><code>window.getSelection().toString()
  </code></pre>
  
  <p>to get the selected text. However, <s>even though Mozilla Developer Network <a href="https://developer.mozilla.org/en-US/docs/Web/API/Selection/toString" rel="nofollow noreferrer">says it should work</a>, in Firefox,</s> this doesn't give the selected text but rather the literal string <code>Instance of 'Selection'</code>.</p>
  
  <p><s>What's the correct way to get the selected text?</s></p>