views:

150

answers:

2

Hey,

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?

+4  A: 

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.

thenduks
`<div />` is valid in XHTML. You shouldn't use it because it messes up in IE.
Tim Down
@Tim: [citation needed] :), `<div />` is definitely valid _XML_, but everything I've ever come across says `div`s are not self-closing elements. `script` is another good example. I could be wrong on this, for sure. However, as you pointed, out IE explodes when given self-closing divs, so the answer still remains -- stay away :)
thenduks
+1  A: 

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.

Tim Down