I have following HTML markup as an input to be pasted onto IE browser in place of selected content on the browser :
Note: 1. <fact> is a custom tag.
2. FactType, IsFactMarked and keyword and custom attributes.
<span id='fs_892_3006_0' class='ParaMarked' FactType='NonNumeric' onclick='OnSpanClick("fs_892_3006_0", event)' IsFactMarked='true'>
<fact id='892_3006_0' keyword=''>
<P style="margin: 0pt 0pt 10pt; line-height: 115%; font-size: 11pt;">
<SPAN style="font-family: Calibri; font-size: 11pt;">THIS IS A TEST CONTENT 1</SPAN>
</P>
</fact>
</span>
However, when the HTML is rendered, IE adds extra tags surrounding this HTML as shown below:
<p style="margin: 0pt 0pt 10pt; line-height: 115%; font-size: 11pt;">
<span style="font-family: Calibri; font-size: 11pt;">
<span id="fs_892_3006_0" class="ParaMarked" onclick='OnSpanClick("fs_892_3006_0", event)' IsFactMarked="true" FactType="NonNumeric">
<fact id="892_3006_0" keyword=""></p><p style="margin: 0pt 0pt 10pt; line-height: 115%; font-size: 11pt;"><span style="font-family: Calibri; font-size: 11pt;">THIS IS A TEST CONTENT 1</span></p></fact></span></span>
I have tried below techniques to paste HTML onto browser, but gives same result:
1. pasteHTML(markedText)
2. Rangy library :
var sel = rangy.getSelection();
var range = sel.getRangeAt(0);
range.deleteContents();
var node = range.createContextualFragment(markedText);
range.insertNode(node);
Any pointers on this would be appreciated.
Thanks.