title: window.getSelection() to select text only within class
body: <p>I have <code>contenteditable=true</code> div, where user enters his feedback and I want to allow him change the text color of selected text written in div when user clicks on colorpalate.</p>
  
  <p>I have full code to do my task of changing the color of selected text with user desired color.
  But...
  Everthing else on the page can be selected and changed its colour too, which I want to prevent. I want to allow change the colour only for class="comment".</p>
  
  <p>Just can't understand how to do that with below code.</p>
  
  <p><code>if (window.getSelection) { // all browsers, except IE before version 9
             var selectionRange = window.getSelection (); 
                  if (selectionRange.isCollapsed) {
                      alert ("Please select some content first!");
                  }
                  else { 
                        //do the stuff
                       }
         }</code></p>
  
  <p>Thanks for help</p>