David
David

Reputation: 2569

Help! TinyMCE is reformatting my code!

when i edit the HTML source from:

<div />

the result is always something like:

<div></div>

i don't want that.. it should leave my code alone ;)

here is the config:

tinyMCE.init({
// General options
mode : "textareas",
theme: "advanced",
element_format : "xhtml",
    remove_linebreaks: false,
    remove_redundant_brs: false,
    cleanup_on_startup : false,
    cleanup: false, // cleanup: true -> custom_elemts are not working...
    verify_html : false,
    forced_root_block: false,
    apply_source_formatting: false,
    fix_nesting: false,
    fix_table_elements: false,
    fix_list_elements : false,
    fix_content_duplication : false,
    preformatted : false,

    extended_valid_elements: "pbo:*[*]",

});

any ideas?

Upvotes: 1

Views: 674

Answers (2)

Tim Down
Tim Down

Reputation: 324667

You really really don't want <div /> tags. They are not valid HTML (and IE always parses documents as HTML) and will break DOM traversal methods in IE.

Upvotes: 3

rfunduk
rfunduk

Reputation: 30452

You're specifying the format as xhtml and divs cannot be self-closing -- that's why it's fixing it for you. If you want it to be exactly as you say then you'll need to change the element_format property.

Upvotes: 6

Related Questions