Browser in DesignMode wrapping orphan LI elements in UL - Firefox and Chrome

152 views Asked by At

I am using TinyMce to implement a WYWIWYG Editor for a web application. The application allows a user to edit tokens containing partial HTML. For example, a token being edited may contain:

<li>some text</li>

However, when I call SetContent on the editor with value <li>some text</li>, the element gets automatically wrapped in an <ul> element. As far as I can tell, this is being done not by TinyMCE, but by the browser itself.

I understand that this is the browser's way of creating valid HTML, and unfortunately I don't have any way around allowing the user to edit invalid elements (invalid only because the li is not inside a ul).

This happens in both FireFox and Chrome, Is there a way to prevent the browser from doing this (when calling setHtml) and allow invalid HTML (even say, open p tags)?

1

There are 1 answers

0
Thariama On

Why do you want to have invalid html?

Apart from that you shoud have a closer look to the tinymce configuration settings valid_children and valid_elements.