title: Discontigious Selection is not supported error in google chrome and chromium
body: <p>I am working on a bookmark app where i have to store the user's selected keywords or words or content. I am using the createRange() and addRange() javascript methods to create the range and then find out the selected elements/contents by the user. The code i written for this is as follow.  </p>
  
  <pre><code>&lt;head&gt;
  &lt;script type="text/javascript"&gt;
      var storedSelections = [];
  
      function StoreSelection () {
          if (window.getSelection) {
              var currSelection = window.getSelection ();
              for (var i = 0; i &lt; currSelection.rangeCount; i++) {
                  storedSelections.push (currSelection.getRangeAt (i));
              }
              currSelection.removeAllRanges ();
          } else {
              alert ("Your browser does not support this example!");
          }
      }
  
      function ClearStoredSelections () {
          storedSelections.splice (0, storedSelections.length);
      }
  
      function ShowStoredSelections () {
          if (window.getSelection) {
              var currSelection = window.getSelection ();
              currSelection.removeAllRanges ();
              for (var i = 0; i &lt; storedSelections.length; i++) {
                  currSelection.addRange (storedSelections[i]);
              }
          } else {
              alert ("Your browser does not support this example!");
          }
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      Select some content on this page and use the buttons below.&lt;br /&gt;         &lt;br /&gt;
      &lt;button onclick="StoreSelection ();"&gt;Store the selection&lt;/button&gt;
      &lt;button onclick="ClearStoredSelections ();"&gt;Clear stored selections
  &lt;/button&gt;
      &lt;button onclick="ShowStoredSelections ();"&gt;Show stored selections&lt;/button&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>This code is working perfectly on Firefox. I am able to select multiple things one by one and able to show the selected content again but on chrome and chromium i am getting <code>Discontiguous selection is not supported.</code> error when i store more than one elements in range array and click on show stored selections button.</p>
  
  <p>Help will be appreciated. And please suggest me if there is some other alternatives do accomplish this bookmarking task. </p>