Quantcast
Viewing all articles
Browse latest Browse all 1908

IE 9 adding extra HTML tags while rendering

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: 

Note: "markedText" is the javascript variable which contains the HTML input as mentioned above 

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.


Viewing all articles
Browse latest Browse all 1908

Trending Articles