How to select(highlight) and copy ordered list numbers
<p>I need to process selected(highlighted with mouse) text in html page. But if I'm selecting ordered list &lt;ol&gt;&lt;/ol&gt; elements I'm losing numbering information. Maybe someone can help me with this information extraction, because if I select and copy+paste selection to text editor - I see those numbers. Function used for html fragment selection:</p>

<pre><code>function getSelectionHtml() {
    var html = "";
    if (typeof window.getSelection != "undefined") {
       var sel = window.getSelection();
       if (sel.rangeCount) {
           var container = document.createElement("div");
           for (var i = 0, len = sel.rangeCount; i &lt; len; ++i) {
               container.appendChild(sel.getRangeAt(i).cloneContents());
           }
           html = container.innerHTML;
       }
   } 
   else if (typeof document.selection != "undefined") {
       if (document.selection.type == "Text") {
           html = document.selection.createRange().htmlText;
       }
   }
   return html;
}
</code></pre>

<p>Complete fiddle example : <a href="https://jsfiddle.net/t2mhcbyo/3/" rel="nofollow">https://jsfiddle.net/t2mhcbyo/3/</a></p>