Prevent RadEditor from closing tags

6 posts, 1 answers
  1. David Kalsbeek
    David Kalsbeek avatar
    3 posts
    Member since:
    Mar 2008

    Posted 09 Mar 2011 Link to this post

    I've got two RadEditors collecting static content to put above and below some data driven content that will wind up rendering out on the page like

    << content from RadEditor1 >>
    << data driven content >>
    << content from RadEditor2 >>

    I'd like to allow a <div> or <table><tr><td> to be left open in RadEditor1 to be followed by </div> or </td></tr></table> in RadEditor2 (this would be entered in the HTML view of the editor).

    I've tried setting the ContentFilters to None and the RadEditor automatically closed the tags. So RadEditor HTML would start with <table><tr><td> and when I switch to the designer and back to HTML I now see <table><tbody><tr><td></td></tr></tbody></table>. 

    Is is possible to force RadEditor to not fix the HTML for me?

    Thanks for your help!
  2. Answer
    Rumen avatar
    14324 posts

    Posted 09 Mar 2011 Link to this post

    Hello David,

    It is not supported by the Rich Text Editing engine of the browser to have only an opening <div> or another tag or only a closing </div> tag in the content area. Every HTML tag is a node in the DOM and it should have an opening and closing tag, in other case the content will be invalid HTML/XHTML.

    The browser's Rich Text Editing engine checks for unclosed and non well formed tags and corrects or try to correct them automatically without providing a way to disable the browser validation. You can verify my words by testing the attached HTML page with an editable IFRAME element in it. You will reproduce the same behavior with an editable DIV element as well as in our competitors' editors.

    Best regards,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. JDs
    JDs avatar
    1 posts
    Member since:
    Aug 2015

    Posted 26 Aug 2015 in reply to Rumen Link to this post

    Are non well formed tags and html still not able to go uncorrected? The html fully gets changed if one thing in the html is incorrect and forces us to figure out what our html was before the editor "attempted" to fix the non well formed html.
  4. Ianko
    Ianko avatar
    1934 posts

    Posted 28 Aug 2015 Link to this post


    As Rumen has explained in his post, the functionality that corrects malformed HTML is a browser technology which is not optional and cannot be disabled.

    RadEditor has nothing to do with that logic and therefore, it cannot control it.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Matt
    Matt avatar
    99 posts
    Member since:
    Jun 2012

    Posted 30 Jul 2018 in reply to Ianko Link to this post

    True but often I'm forced to create a work-around for something that doesn't work right in Telerik controls... suggest you do the same (adjust to deal with something you can't change).
  6. Rumen
    Rumen avatar
    14324 posts

    Posted 31 Jul 2018 Link to this post

    Hi Matt,

    The web development is a very dynamically changing environment. Almost each month the browser vendors release updates and sometimes major, which often breaks existing properly working functionality and adds regressions in the controls.

    In this fast changing world, we are always striving to provide the best suggestions, workarounds and fixes that are currently available.

    For the concrete situation, there isn't much to do since this behavior is not only controlled by the underlying rich text editing engine of the browser, but if you leave some tags unclosed, this won't be a valid HTML/XHTML/HTML5 and we will receive complaints for that the editor does not correct the content, which is one of its top features - see the Built-in Content Filters article.

    I hope that I delivered clarification on this topic.

    Best regards,
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top