I apologize if this is documented elsewhere, but I was unable to find any mention of it...
In IE 11 and FF, I have a document that consists of several paragraphs. Inside those paragraphs are nothing but plain text. As soon as I place my cursor within one of the paragraphs, the following code is inserted at the end of the paragraph:
IE 11: <br></br>
Firefox: <br type="_moz"></br>
Can anyone explain what causes this and how to fix it? Thank you.
This is a native browsers
This is a native browsers behaviour. Firefox and IE11 too (iirc) do this very eagerly, so every time you move selection to a block, a <br> is appended inside. Chrome, Safari and Opera do this too, but only to fill empty blocks. Though, you can find them in many situations, because once appended, they will often be kept. The reason of this seemingly ridiculous behaviour is that in order to "show" empty block, it has to have... some content. Browser vendors chose different ways to solve this issue. Modern browsers use <br>s when old IEs use non breaking spaces or... nothing at all (or rather a trick in a rendering engine).
Those <br>s are called "bogus brs".
However, this affects only the inner HTML of the editor. When you get content using the getData() method those <br>s are removed by editor filters. Symmetrically, when setting data, <br>s are added inside empty blocks that need fillers. This is handled by CKEditor and if you use it correctly, you don't have to worry about this at all, unless, you are implementing your own plugin. In such case you need to take bogus <br>s for granted and learn to live with them as we all did.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Thank you. Your suggestion to
Thank you. Your suggestion to rely on getData(), which I was not doing, was helpful.