Magento, TinyMCE and empty divs

Some JS scripts require empty divs, or perhaps you like to use them in combination with CSS to build blocks, menu’s etc.
By default TinyMCE does not allow you to use empty div’s and it will remove them without further notice. So even if you click “Show/hide editor” in Magento 1.4+.x and add your div it will disappear…

You can overcome this nasty behaviour by adding an option to the settings array Magento presents to the TincyMCE javascript.

In /js/mage/adminhtml/wysiwyg/tiny_mce edit the file setup.js and add the following line:
extended_valid_elements : “div[*]”,
Somewhere between var settings = { and };
(except you the last line, ad you should remove the last comma for syntax reasons… (duh))

(I would recommend cleaning your browsers cache after this) Reload the page, et voilá! You can now add empty div’s like “

“.