title: Clear a selection in Firefox
body: <p>I have this function    </p>
  
  <pre><code>function smth() {
  var container = null;
  var newContainer = null;
  if (window.getSelection) {  // all browsers, except IE before version 9
      alert("first if");
      var selectionRange = window.getSelection();
      if (selectionRange.rangeCount &gt; 0) {
          var range = selectionRange.getRangeAt(0);
          container = range.commonAncestorContainer;
          newContainer = container;
      }
  }
  else {
      if (document.selection) {   // Internet Explorer
          alert("second if");
          var textRange = document.selection.createRange();
          container = textRange.parentElement();
      }
  }
  
  if (newContainer) {
      return newContainer.nodeName;
  }
  else {
      alert("Container object for the selection is not available!");
  }
  }     
  </code></pre>
  
  <p>Now after i do what i need to do with the selection i need to clear it. i tried a few things nothing worked, any ideas?    </p>
  
  <pre><code>document.selection.clear ()    
  </code></pre>
  
  <p>this didnt work.</p>