This is a migrated thread and some comments may be shown as answers.

[Solved] Rad Editor keeps changing my document

1 Answer 88 Views
Editor
This is a migrated thread and some comments may be shown as answers.
JB
Top achievements
Rank 1
JB asked on 25 Sep 2009, 04:04 PM
I'm trying to use the Rad Editor to build a document, but it seems to change my document when I switch between the design view and html view.

How can this be avoided?

I enter this
<!--
CUSTOM CODE HERE
--> 
fail 
<!--
CUSTOM CODE HERE
--> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
    <head> 
    </head> 
    <body>       
       some text 
    </body> 
</html> 
<!--
CUSTOM CODE HERE
--> 


and its converted to this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
    <head> 
<!--
CUSTOM CODE HERE
--> 
    </head> 
    <body> 
        fail 
<!--
CUSTOM CODE HERE
--> 
      some text 
<!--
CUSTOM CODE HERE
--> 
    </body> 
</html> 


1 Answer, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 29 Sep 2009, 10:50 AM
Hi JB,

The HTML specification clearly states that if a <!DOCTYPE> element is present it must be the first element on the page. No other elements are allowed prior to it - period.

In this particular case, it is not the editor that "re-arranges" the tags, but the underlying browser engine - which *tries* to *fix* the incosnistent HTML *for you*.

To cut  a long story short - you will not be able to have any content prior to the <!DOCTYPE> declaration. If this is a requirement for your project, you will need to join this extra content with the *normal* content at a later stage - e.g. once that the content has been submitted from the editor to the server.

Best wishes,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
JB
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Share this question
or