Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4624)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4625)
@@ -102,4 +102,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4594">#4594</a> : Fixed context menu goes off-screen when mouse is at right had side of screen.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4673">#4673</a> : Fixed undo not available straight away if shift key is used to enter first character.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4690">#4690</a> : Fixed the parsing of nested inline elements.</li>
 	</ul>
 	<h3>
Index: /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/fragment.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/fragment.js	(revision 4624)
+++ /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/fragment.js	(revision 4625)
@@ -265,6 +265,16 @@
 		parser.onTagClose = function( tagName )
 		{
-			var index = 0,
-				pendingAdd = [],
+			// Check if there is any pending tag to be closed.
+			for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- )
+			{
+				// If found, just remove it from the list.
+				if ( tagName == pendingInline[ i ].name )
+				{
+					pendingInline.splice( i, 1 );
+					return;
+				}
+			}
+
+			var pendingAdd = [],
 				candidate = currentNode;
 
@@ -274,11 +284,5 @@
 				// it will continue after the closing tag.
 				if ( !candidate._.isBlockLike )
-				{
 					pendingInline.unshift( candidate );
-
-					// Increase the index, so it will not get checked again in
-					// the pending list check that follows.
-					index++;
-				}
 
 				// This node should be added to it's parent at this point. But,
@@ -310,24 +314,4 @@
 				if ( candidate == currentNode )
 					currentNode = currentNode.parent;
-			}
-			// The tag is not actually closing anything, thus we need invalidate
-			// the pending elements.(#3862)
-			else
-			{
-				pendingInline.splice( 0, index );
-				index = 0;
-			}
-
-			// Check if there is any pending tag to be closed.
-			for ( ; index < pendingInline.length ; index++ )
-			{
-				// If found, just remove it from the list.
-				if ( tagName == pendingInline[ index ].name )
-				{
-					pendingInline.splice( index, 1 );
-
-					// Decrease the index so we continue from the next one.
-					index--;
-				}
 			}
 		};
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4624)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4625)
@@ -1,3 +1,3 @@
-﻿/*
+/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -82,9 +82,4 @@
 		// Load the dialog definition.
 		var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ];
-		if ( !definition )
-		{
-			console.log( 'Error: The dialog "' + dialogName + '" is not defined.' );
-			return;
-		}
 
 		// Completes the definition with the default values.
