<script>
  oSelection = window.getSelection();
  oRange = document.createRange();
  oSelection.addRange(oRange);
  oRange.detach();
  oSelection.removeRange(oRange);
</script>