title: JavaScript selectionchange event for a particular element only
body: <p>I want to implement a JavaScrit <code>selectionchange</code> event on a particular <code>div</code> element, so if the user selects text from the DOM I want to show a highlighter box. I have implemented this for web with an <code>onmouseup</code> event. But I am stuck trying to implement this for mobile devices.</p>
  
  <p>For mobile browsers I am binding <code>document.selectionchange</code> event on the DOM, but I want this to only apply for a particular element which has the <code>content-editable</code> class. So the highlighter will show only when the user selected text within the container on page which has the <code>content-editable</code> class.</p>
  
  <pre><code>document.addEventListener("selectionchange", function(evt) { 
    // Now this functionality only apply for content-editable class div.
  });
  </code></pre>
  
  <p>How can I implement this functionality? Perhaps it could be implemented with a recursive function to find <code>parentElement</code>'s class of <code>anchorNode</code> of selected text like: </p>
  
  <pre><code>var selection = ctrl.window.getSelection();
  </code></pre>
  
  <p>What is the best way to do this?</p>