Index: /FCKeditor/trunk/editor/_source/classes/fckstyle.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckstyle.js	(revision 851)
+++ /FCKeditor/trunk/editor/_source/classes/fckstyle.js	(revision 852)
@@ -687,4 +687,63 @@
 	_ApplyInlineStyle : function( range, selectIt )
 	{
+		if ( range.CheckIsCollapsed() )
+		{
+			// Create the element to be inserted in the DOM.
+			var collapsedElement = this.BuildElement( range.Window.document ) ;
+
+			// The following, which would be the correct and simple way for it,
+			// doesn't work:
+			//		IE: The inserted node desappears (due to the Select() call).
+			//		FF: Almost work, but the caret disappears. Start typying
+			//		    and the style is correctly applied.
+			//		Opera: It seams that the element is added to the DOM, but
+			//		    the selection is not inside of it. Also, the empty
+			//		    elements renders a small space.
+			//		Safari: The element is added to the DOM, but the selection
+			//		    is not inside of it.
+			//range.InsertNode( collapsedElement ) ;
+			//range.MoveToNodeContents( collapsedElement ) ;
+			//range.Select() ;
+
+			if ( FCKBrowserInfo.IsOpera )
+			{
+				// Opera has a special case.
+				collapsedElement.innerHTML = '&nbsp;' ;
+				range.InsertNode( collapsedElement ) ;
+				range.MoveToNodeContents( collapsedElement ) ;
+				range.Select() ;
+				FCKSelection.Delete() ;
+			}
+			else if ( FCKBrowserInfo.IsSafari )
+			{
+				// For now, no support for it on Safari.
+			}
+			else
+			{
+				// For FF and IE, we must have something inside
+				// collapsedElement, otherwise the element is automatically
+				// removed by the browser in the selection operation, or even
+				// remain there, but with no blinking cursor.
+				var dummySpan = collapsedElement.appendChild( range.Window.document.createElement( 'span' ) ) ;
+
+				// Our dummySpan must be filled on IE, otherwise it will be
+				// removed when selecting.
+				if ( FCKBrowserInfo.IsIE )
+					dummySpan.innerHTML = '&nbsp;' ;
+
+				range.InsertNode( collapsedElement ) ;
+				range.MoveToPosition( collapsedElement, 2 ) ;
+				range.Select() ;
+
+				// After the selection, it is safe to cleanup dummySpan's
+				// contents, so it is ignored by the browser, but still forces
+				// collapsedElement to stay in the document.
+				if ( FCKBrowserInfo.IsIE )
+					FCKDomTools.RemoveNode( dummySpan ) ;
+			}
+
+			return ;
+		}
+
 		// The general idea here is navigating through all nodes inside the
 		// current selection, working on distinct range blocks, defined by the
@@ -712,34 +771,4 @@
 		// is not needed anymore.
 
-		if ( range.CheckIsCollapsed() )
-		{
-			// The following doesn't work.
-//			var collapsedElement = this.BuildElement( range.Window.document ) ;
-//			range.InsertNode( collapsedElement ) ;
-//			range.MoveToNodeContents( collapsedElement ) ;
-//			range.Select() ;
-
-			// The following works with IE & Firefox, but doesn't work with Safari & Opera.
-			// It seams that the selection is not working for them.
-//			var collapsedElement = this.BuildElement( range.Window.document ) ;
-//			collapsedElement.appendChild( range.Window.document.createElement( 'span' ) ) ;
-//			collapsedElement.appendChild( range.Window.document.createElement( 'span' ) ) ;
-//			collapsedElement.firstChild.innerHTML = '&nbsp;' ;
-//			collapsedElement.lastChild.innerHTML = '&nbsp;' ;
-//			range.InsertNode( collapsedElement ) ;
-//			range.MoveToPosition( collapsedElement.firstChild, 4 ) ;
-//			range.Select() ;
-//			collapsedElement.firstChild.innerHTML = '' ;
-//			collapsedElement.lastChild.innerHTML = '' ;
-
-			// An idea would be calling a standard execCommand for formatting
-			// and wait "after" a keystroke or paste. Then, if the formatting
-			// tag exists and has contents, replace it with the real element.
-			// range.Window.document.execCommand( 'FontName', false, '__FCKeditorTemp' ) ;
-
-			// For now, we do nothing for collapsed selections.
-			return ;
-		}
-
 		var elementName = this.Element ;
 
