Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

execCommand using formatBlock breaks html with embedded divs.

$
0
0

Using the command:
return ((IHTMLDocument2)ContributorGlobals.Instance.HtmlDocument).execCommand("formatblock", false, "Normal");

If we highlight the 'Feature box' in a browser then change the style from 'H2' to 'Normal', so changing back to normal text then the command changes the HTMLDocument (which is a mshtml.IHTMLDocument) activeElement.innerHTML from this:

"<DIV class=fb01>\r\n<DIV class=fb01_top>\r\n<H2>Feature box</H2>\r\n<P>Test</P></DIV></DIV>"

To this:

"<P class=fb01>Feature box</P>\r\n<DIV class=fb01_top>\r\n<P>Test</P></DIV>"

From our investigation this seems to happen with any blockformat command changes values, so changing to H2 or others with the embedded DIV tags. We have also tried to rewrite to allow this to work, but still find there are cases where this will not work.

Is this a bug with this or is there any workaround to make this work?


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>