XHTML formatting on IMG closing tag missing

2 posts, 1 answers
  1. NTS
    NTS avatar
    4 posts
    Member since:
    Nov 2015

    Posted 28 Jul 2016 Link to this post



    I see this happening.

    Markup is shown properly in the HTML view of the RadEditor, but is stripped when rendered on the page.

    Here is my HTML as shown in the RadEditor:

    <p><img alt="the other" src="/PublishingImages/Signing-4730x.jpg" /></p

    Note the end tags on IMG when the page is rendered I get this:
    <p><img alt="the other" src="/PublishingImages/Signing-4730x.jpg"></p>


    Also see this old post from 2009

    Is this issue still applicable on the latest version of the RADEditor?


    Ps. I know the <img> tag is a self closing tag, so the latter html is still valid. see here





  2. Answer
    Ianko avatar
    1738 posts

    Posted 02 Aug 2016 Link to this post

    Hello John,


    The results that you get in the HTML inspector of the browser is a result of the browser engine not RadEditor's. 


    No matter how and where the img tags is inserted, void elements will be transformed to <[void] >, without the closing tag. You can see absolutely the same result here: https://jsbin.com/yaloyoxonu/edit?html,output


    However, RadEditor's ConvertToXhtml filter handles the situation in order to preserve the XHTML compliance of the content (http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/content-filters). Therefore, getting the HTML by using the RadEditor API will get you an XHTML compliant result.


    I hope this clarifies the situation you have.


    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top