javascript - Why does IE inject an extra </tbody> end tag into my table when parsing and serializing HTML? -
I have already considered this question, which states why domParsing is being added & lt; Tbody & gt; To tag tags, if the parseed is not already in the table
me & lt; Tbody & gt; There is not a problem adding the
tag, but I see an issue with IE 11 where two & lt; / Tbody & gt; & Lt; / Tbody & gt; End tags are being added to the output, even if only a & lt; Tbody & gt; Start tag breaks my application because the resulting XML is no longer valid XHTML
html = '& lt; Html & gt; & Lt; Principal & gt; & Lt; Title & gt; Serializer difference & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; H2 & gt; Software & lt; / H2 & gt; & Lt; / TD & gt; & Lt; TD & gt; Some text & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt; '; DomParser = new DOMParser (); XmlSerializer = New XMLSerializer (); Doc = domParser.parseFromString (html, 'text / html'); Console.log (xmlSerializer.serializeToString (doc));
You can play with Bella here:
On IE11, the output is:
& lt; / Tbody & gt;
Expected output as Chrome, Firefox, Canary, only single and
tags.
I'm using input HTML data Am not in my control I have tried to use parseFromString (html, 'application / xhtml + xml'), but there are several issues with MS Word in HTML (suprise!) < / P>
Can I do anything else in my javascript parsing to stop the end tag of this double tibb?
Comments
Post a Comment