HTML Editor adding additional formatting to the content pasted in the HTML field


Description

HTML source code editor overwrites/ changes data originally entered by the user.
Here's an example.

"
<ol>Test
<ul> <li>Test</li>
<li>Test</li>
</ul>
<ul> <li>Test</li>
<li>Test</li>
</ul>
<ol> <li>Test</li>
<li>Test</li>
</ol>
</ol>

"

It will get updated to -

"
<p></p>
<ol>Test
<li style="list-style-type: none;">
<ul>
<li>Test</li>
<li>Test</li>
</ul>
</li>
<li style="list-style-type: none;">
<ul>
<li>Test</li>
<li>Test</li>
</ul>
</li>
<li style="list-style-type: none;">
<ol>
<li>Test</li>
<li>Test</li>
</ol>
</li>
</ol>

"

Resolution

It is expected behavior. In an attempt to correct the syntax the HTML editor adds the additional code for correcting the formatting.
In the sample code above, there is a <ul> tag used without starting with <li>. Similarly, there is no need to add <ul></ul> again when the Unordered list is continuing. If there is a need to nest an unordered list in an ordered list or vice-versa it should start with a <li> tag and end at an appropriate location.

The HTML editor will not add the additional code when the formatting is correct. For example, the HTML editor will not add the styling or add minimal code when the source code that is added is like below.


<ol>
                <li>Test
                                    <ul>
                                            <li>Test</li>
                                            <li>Test</li>
                                            <li>Test</li>
                                            <li>Test</li>
                                </ul>
                </li>
            <li>test
                                    <ol>
                                            <li>Test</li>
                                            <li>Test</li>
                                </ol>
            </li>
</ol>