title: Javascript: Getting and saving text selection ranges in a database
body: <p>I'm building a gramma-checker system for a client, where users can add comments/suggestions to a given text. When a user selects some text, a button appear to create a comment/suggestion to that given text selection. My problem comes when I want to save the text selection range in a database, along with the comment/suggestion. </p>
  
  <p>I'm currently trying to solve the problem by using Rangy (<a href="http://rangy.googlecode.com/" rel="nofollow">http://rangy.googlecode.com/</a>).</p>
  
  <p>These are the ideas I'v tried so far:</p>
  
  <ul>
  <li>Using the rangy serializer to serialize the range. The problem with
  this approach is that the DOM is changing each time a new
  comment/suggestion is added, and therfore not allowing for a
  successful deserialization.</li>
  <li>Using the rangy selection wrapper and save that directly in the
  database, but like the idea above, the target elements content is
  changing with each comment/suggestion, which again makes the approach
  not work as intended.</li>
  </ul>
  
  <p>Any suggestions to how I could solve this problem would be appriciated.</p>