Range for Complex Selection
<p>I want to highlight the user selected Text. I cant use the JQuery Based API for Highlight since I want user specific highlight.</p>

<p>Here is how my code looks like.</p>

<pre><code>var range = window.getSelection().getRangeAt(0);
var sel = window.getSelection();
range.setStart( sel.anchorNode, sel.anchorOffset );
range.setEnd(sel.focusNode,sel.focusOffset);
highlightSpan = document.createElement("span");
highlightSpan.setAttribute("style","background-color: yellow; ");
highlightSpan.appendChild(range.extractContents()); 
range.insertNode(highlightSpan)    
</code></pre>

<p>This works in normal scenarios but if I select some text in different paragraphs the extractContents API will validate the HTML returned and put additional tags to make it valid HTML. 
I want the exact HTML that was selected without the additional validating that javascript did. </p>

<p>Is there any way this can be done?</p>

<p>Regards,
Tina</p>
