Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 5748)
+++ /CKEditor/trunk/CHANGES.html	(revision 5749)
@@ -93,4 +93,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/5735">#5735</a> : IE: The editor was having focus issues when the previous selection got hidden by scroll operations.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/5563">#5563</a> : Firefox: The disableObjectResizing and disableNativeTableHandles stopped working.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/5781">#5781</a> : Firefox: Editing was not possible in an empty document.</li>
 		<li>Updated the following language files:<ul>
 			<li><a href="http://dev.fckeditor.net/ticket/5962">#5962</a> : German;</li>
Index: /CKEditor/trunk/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/wysiwygarea/plugin.js	(revision 5748)
+++ /CKEditor/trunk/_source/plugins/wysiwygarea/plugin.js	(revision 5749)
@@ -197,4 +197,32 @@
 	isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );
 
+	// Gecko need a key event to 'wake up' the editing
+	// ability when document is empty.(#3864, #5781)
+	function activateEditing( editor )
+	{
+		var win = editor.window,
+			doc = editor.document,
+			body = editor.document.getBody(),
+			bodyChildsNum = body.getChildren().count();
+
+		if ( !bodyChildsNum || ( bodyChildsNum == 1&& body.getFirst().hasAttribute( '_moz_editor_bogus_node' ) ) )
+		{
+			restoreDirty( editor );
+
+			// Simulating keyboard character input by dispatching a keydown of white-space text.
+			var keyEventSimulate = doc.$.createEvent( "KeyEvents" );
+			keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,
+				false, false, false, 0, 32 );
+			doc.$.dispatchEvent( keyEventSimulate );
+
+			// Restore the original document status by placing the cursor before a bogus br created (#5021).
+			bodyChildsNum && body.getFirst().remove();
+			doc.getBody().appendBogus();
+			var nativeRange = new CKEDITOR.dom.range( doc );
+			nativeRange.setStartAt( body , CKEDITOR.POSITION_AFTER_START );
+			nativeRange.select();
+		}
+	}
+
 	/**
 	 *  Auto-fixing block-less content by wrapping paragraph (#3190), prevent
@@ -210,4 +238,6 @@
 			body = editor.document.getBody(),
 			enterMode = editor.config.enterMode;
+
+		CKEDITOR.env.gecko && activateEditing( editor );
 
 		// When enterMode set to block, we'll establing new paragraph only if we're
@@ -420,26 +450,5 @@
 						}
 
-						// Gecko need a key event to 'wake up' the editing
-						// ability when document is empty.(#3864)
-						if ( CKEDITOR.env.gecko && !body.childNodes.length )
-						{
-							setTimeout( function()
-							{
-								restoreDirty( editor );
-
-								// Simulating keyboard character input by dispatching a keydown of white-space text.
-								var keyEventSimulate = domDocument.$.createEvent( "KeyEvents" );
-								keyEventSimulate.initKeyEvent( 'keypress', true, true, domWindow.$, false,
-									false, false, false, 0, 32 );
-								domDocument.$.dispatchEvent( keyEventSimulate );
-
-								// Restore the original document status by placing the cursor before a bogus br created (#5021).
-								domDocument.createElement( 'br', { attributes: { '_moz_editor_bogus_node' : 'TRUE', '_moz_dirty' : "" } } )
-									.replace( domDocument.getBody().getFirst() );
-								var nativeRange = new CKEDITOR.dom.range( domDocument );
-								nativeRange.setStartAt( new CKEDITOR.dom.element( body ) , CKEDITOR.POSITION_AFTER_START );
-								nativeRange.select();
-							}, 0 );
-						}
+						CKEDITOR.env.gecko && CKEDITOR.tools.setTimeout( activateEditing, 0, null, editor );
 
 						domWindow	= editor.window		= new CKEDITOR.dom.window( domWindow );
