Topic: mce_bogus

I have no idea why, but tinymce is inserting the following code into my empty textareas:

<br mce_bogus="1">

I couldn't find any information as to why it would do this...so unfortunately I have to go the dirty route. I found the following in tiny_mce.js:

o.content=t.dom.setHTML(t.getBody(),'<br mce_bogus="1" />',1)

...and I deleted it. I know. It's horrible. It's not the best way and a nightmare if you want to update tinymce in the future. But until someone can give me an idea of how to prevent this behavior it's my only choice sad


Re: mce_bogus

I'm experiencing this too.

My config code looks like this:

        mode : "textareas",
        theme : "advanced",
        editor_selector : "mceEditor",
        plugins : "fullscreen",
        theme_advanced_buttons1 : "fullscreen,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,separator,forecolor,backcolor,fontsizeselect",
        theme_advanced_buttons2_add : "separator,hr,charmap,fullscreen",
        theme_advanced_buttons3: "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_source_editor_height : "600",
        fullscreen_new_window : true,
        fullscreen_settings : {
          theme_advanced_toolbar_location : "top",
          theme_advanced_toolbar_align : "left"
        elements : 'nourlconvert',
        theme : "advanced",
        plugins : 'advlink,advimage',
        convert_urls : false

I have two TEXTAREAS on the form.

The first textarea does not have a "class" tag

The second textarea has class="mceEditor".

When the form loads, the first textarea is filled with the text...

<p><br mce_bogus="1"></p>

...but it is otherwise a normal textarea

The second textarea is properly rendered as the TinyMCE wyswyg control.

Is there any solution, other than hacking the Tiny code as divisionoftigers has done?

Last edited by idearob (2008-03-26 17:39:50)


Re: mce_bogus

Yeah, I get it as well, and it means that TinyMCE does not work properly in advanced mode on my home page but does work on (WordPres) permalink blog pages, in the comments section. Still trying to figure out why, and if I have to hack the .js file like some of you did, that's what I'll have to do I guess.


Re: mce_bogus

I had the same problem, and I solved by adding "cleanup: true" in the tinyMCE.init jscript.

"cleanup: false": a <BR mce_bogus="1"> will be added also in empty table cells;
"cleanup: true": when you have a table cell with just spaces or   it deletes all of them from the cell. This may be annoying if you need to have a non-empty cell (ie, to show just a border). In this case, you have to use "cleanup: false" and your empty cells will be filled using just one <BR mce_bogus="1">

I hope this may be useful for you.


Re: mce_bogus

the <br mce_bogus="1"> has been added to empty table cells because the table handling of firefox is bad. So if you add a empty table it was impossible to edit it's content if you leave the table empty and want to edit it again after you post the form...

Grtz, Laurence


Re: mce_bogus

What worked for me is to add:

br[mce_bogus] {display: none;}

to your editor css file.


Re: mce_bogus

We kind of added <br mce_bogus="1" /> for a reason. Everything is done by design and this one resolved FF bugs where the caret can't be placed on specific placed unless there is a BR element there. The mce_bogus tells it to not include it when you save/serialize the contents in the editor.

So if you remove it you will break FF. Also never ever, disable the cleanup unless you have a backend that cleanes up the contents for you and remove this kinds of things.

Best regards,
Spocke - Main developer of TinyMCE


Re: mce_bogus

I managed to strip the string before it gets sent to the server:

function safeInput() {
    comment = document.getElementById("wcomment").value;
    comment = comment.replace(' mce_bogus="1"','');
    var safeComment = escape(comment);
    return safeComment;


Re: mce_bogus

I find a corner case with this mce-bogus element. I understand the need for the bogus element. The issue is that sometimes the bogus element when it is necessary to have it.

Case 1: Editing an existing content from the server where, say, the last element is a table inside a <p>. Because this is an existing clean content, the bogus br is not there, and now you cannot navigate below the table in tinyMCE.

Case 2. TinyMCE can erase bogus br when it is still needed. Consider this:
a. Add a table at the end of the tinyMCE window.
b. You will get <p><table></table><br mce-bogus="1"></p>
c. Move your cursor below the table, this works because of the br
d. press enter
e. the br is correctly erased, because now we have another <p></p> tag
f. press backspace to erase the new <p></p>
g. now you have table inside a <p>, but with no bogus br. Now you cannot go beyond the table.

Are these cases known, and being considered for future fixing?

Thank you,


Re: mce_bogus


this isn't a bug. This is the only way you can have a table element at the end of your content.
If you need to jump back in and get something after the table, use HTML view and add content after the closing table tag.

Last edited by Kennonb (2009-12-17 01:08:47)


Re: mce_bogus

The 'trailing' plugin has been created to fight this type of problems: http://sourceforge.net/tracker/?func=de … tid=738747

Just be careful - I am not sure how does this work with the newest versions of TinyMCE. It should work, but ... wink


Re: mce_bogus

here is a post how to avoid adding bogus in rich editor, it's in russian,
http://wikihowto.ru/%D0%9A%D0%B0%D0%BA_ … B2_TinyMCE
but all you need is add this two lines in your init method
forced_root_block: ,
force_p_newlines: false


Re: mce_bogus

Well, in my case the solution is very simple. A missing comma in initialization.
I had <br mce_bogus="1"> error while my  initialization was like:
"  ...   
  theme_advanced_statusbar_location : "bottom",
  theme_advanced_resizing : true
  editor_selector : "mceFull"
Please note to the mising comma after the value "true".
Upon correcting this typo/syntax mistake, everything became perfect!

I have not examined all the features yet. But I liked this  very much, as far as I examined.
Thanks to developers.

Yavuz Darendelioglu

Last edited by bioyavuz (2010-01-19 11:36:03)


Re: mce_bogus

Using TinyMCE in Joomla! and DocMan, adding categories left a <p><br mce_bogus="1"></p> when the "Description" was left empty. The effect of this was to leave a gap between categories.

Even using the html button and deleting the text had no effect, it came back. The only way I could remove the gap was to hack the database entry and delete the fields content.

Could it be possible for the code to not put <p><br mce_bogus="1"></p> back after it has been deleted?


Re: mce_bogus

Only time you should see this is if you have disabled the cleanup (or if you look with firebug).


Re: mce_bogus

The editor did have cleanup enabled on the front-end of the site but possibly not through the administrators area. I have changed this and will check the effect.


The test worked, no extra gaps.

Thank you

Last edited by bantonia (2010-03-04 13:17:44)


Re: mce_bogus

I have the following code:

<p>15.09.2010<br /><a class="pdf-block" href="http://example.com">Foo</a></p>

and it gets inserted after the anchor:

<p>15.09.2010<br /><a class="pdf-block" href="http://example.com">Foo</a><br mce_bogus="1"></p>

It is only visible in the editmode, fine - but it breaks the layout there as it inserts breaks (obviously). Why does it get inserted here? Without it it's working in Firefox and there is no table cell around...


Re: mce_bogus

Can it be reproduced on the local examples on this site. If so provide us with steps to reproduce it. Thanks.

Best regards,
Spocke - Main developer of TinyMCE


Re: mce_bogus

I tried it with this example (Firefox 3.6.13 Win7):


Steps to reproduce:

1. Klick the HTML-Toolbarbutton
2. Insert the following code (and click "update"):

<p>15.09.2010<br /><a class="pdf-block" href="http://example.com">Foo</a></p><p>16.09.2010<br /><a class="pdf-block" href="http://example.com">Bar</a></p>

3. Examine the HTML with Firebug (in my case there appear those bogus-br's after each link).

Last edited by acme (2010-12-15 10:55:21)


Re: mce_bogus

Yes, that is by design since FF can't place the caret on non existing locations so we need to have a BR at the end of links in order to be out side the link. The BR element is invisible so you don't see it anyway and will be removed once you save.

Best regards,
Spocke - Main developer of TinyMCE


Re: mce_bogus

Ok thanks. Nevertheless it's visible on my local installation in terms of a visible new line (after posting they get removed and it's fine). I'll have to take a deeper look into the CSS, maybe there's some style definition that's causing this BR to have impact on its visibility.

Last edited by acme (2010-12-17 13:35:38)


Re: mce_bogus


Can anyone tell me please why tinymce is adding<br _mce_bogus="1"> in this code

<div id="nav">
          <li id="sm_current"><a href="#" _mce_href="#">Home</a><br _mce_bogus="1"></li>
          <li><a href="2-columns.html" _mce_href="2-columns.html">page 2</a><br _mce_bogus="1"></li>
          <li><a href="#" _mce_href="#">page 3</a><br _mce_bogus="1"></li>
          <li><a href="#" _mce_href="#">page 4</a><br _mce_bogus="1"></li>
          <li><a href="#" _mce_href="#">page 5</a><br _mce_bogus="1"></li>
          <li><a href="#" _mce_href="#">page 6</a><br _mce_bogus="1"></li>


Re: mce_bogus

It's added to place the caret on Gecko and WebKit browsers. Empty elements needs a BR element these bogus elements will be removed when saving and is invisible to the user.

Best regards,
Spocke - Main developer of TinyMCE


Re: mce_bogus

Sometimes I see:

<br _mce_bogus="1">


<br mce_bogus="1">

Is the initial underscore (_) required? If yes, when?


Re: mce_bogus

They only way you can ever see that is if you are getting the raw contents out of the editor. We remove all internal elements by default.

Best regards,
Spocke - Main developer of TinyMCE