Description:
Why is the inserted HTML markup modified even if the ASPxHtmlEditor HTML markup validation is disabled?
Answer:
Our ASPxHtmlEditor provides built-in HTML markup validation. Nevertheless, this is not the only validation.
A browser automatically validates any HTML markup that is assigned to the innerHTML property. User HTML markup is inserted in a page hierarchy when the ASPxHtmlEditor initiates a callback to the server (i.e., when a user switches the View). The browser modifies invalid user HTML markup. However, even valid HTML markup can be modified by the browser. This occurs on the client side before a callback is sent and the result depends on a particular browser. Every browser has its internal rules on how to correct inserted markup.
On the server side, the ASPxHtmlEditor corrects user HTML markup according to XHTML Transitional standard (starting from v12.2 HTML5 standard is also supported). This correction may be canceled in the ASPxHtmlEditor.HtmlCorrecting event handler if e.Handled is set to true. However, in this case, custom logic should be implemented to correct the modified HTML according to the XHTML Transitional or HTML5 standard. Otherwise, a markup modified by a browser will be used in an ASPxHtmlEditor.
We have created the How a browser modifies custom HTML markup entered by a user example that allows you to test how a browser modifies custom HTML markup online.