Index: /CKEditor/branches/versions/3.2.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.2.x/CHANGES.html	(revision 5348)
+++ /CKEditor/branches/versions/3.2.x/CHANGES.html	(revision 5349)
@@ -125,4 +125,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/3846">#3846</a> : Google Chrome - No Img properties after inserting.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/5465">#5465</a> : ShiftEnter=DIV doesn't respect list item when pressing enter at end of list item.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/5454">#5454</a> : After replaced success, the popup window couldn't been closed and a js error occured.</li>
 		<li>Updated the following language files:<ul>
 			<li>Faroese;</li>
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/colorbutton/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/colorbutton/plugin.js	(revision 5348)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/colorbutton/plugin.js	(revision 5349)
@@ -87,11 +87,23 @@
 					panel.hide();
 
-					var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : color || 'inherit' } );
 
 					editor.fire( 'saveSnapshot' );
+
+					// Clean up any conflicting style within the range.
+					new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document );
+
 					if ( color )
-						style.apply( editor.document );
-					else
-						style.remove( editor.document );
+					{
+						var colorStyle = config['colorButton_' + type + 'Style'];
+
+						colorStyle.childRule = type == 'back' ?
+							// It's better to apply background color as the innermost style. (#3599)
+							function(){ return false; } :
+							// Fore color style must be applied inside links instead of around it.
+							function(){ return element.getName() != 'a'; };
+						
+						new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document );
+					}
+
 					editor.fire( 'saveSnapshot' );
 				});
@@ -215,11 +227,5 @@
 		element		: 'span',
 		styles		: { 'color' : '#(color)' },
-		overrides	: [ { element : 'font', attributes : { 'color' : null } } ],
-
-		// Fore color style must be applied inside links instead of around it.
-		childRule : function( element )
-		{
-			return element.getName() != 'a';
-		}
+		overrides	: [ { element : 'font', attributes : { 'color' : null } } ]
 	};
 
@@ -238,10 +244,4 @@
 	{
 		element		: 'span',
-		styles		: { 'background-color' : '#(color)' },
-
-		// It's better to apply background color as the innermost style. (#3599)
-		childRule : function( element )
-		{
-			return false;
-		}
+		styles		: { 'background-color' : '#(color)' }
 	};
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/find/dialogs/find.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/find/dialogs/find.js	(revision 5348)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/find/dialogs/find.js	(revision 5349)
@@ -184,14 +184,23 @@
 			toDomRange : function()
 			{
+				var range = new CKEDITOR.dom.range( editor.document );
 				var cursors = this._.cursors;
 				if ( cursors.length < 1 )
-					return null;
-
-				var first = cursors[0],
-					last = cursors[ cursors.length - 1 ],
-					range = new CKEDITOR.dom.range( editor.document );
-
-				range.setStart( first.textNode, first.offset );
-				range.setEnd( last.textNode, last.offset + 1 );
+				{
+					var textNode = this._.walker.textNode;
+					if ( textNode )
+							range.setStartAfter( textNode );
+					else
+						return;
+				}
+				else
+				{
+					var first = cursors[0],
+							last = cursors[ cursors.length - 1 ];
+
+					range.setStart( first.textNode, first.offset );
+					range.setEnd( last.textNode, last.offset + 1 );
+				}
+
 				return range;
 			},
@@ -823,10 +832,13 @@
 			onHide : function()
 			{
+				var range;
 				if ( finder.matchRange && finder.matchRange.isMatched() )
 				{
 					finder.matchRange.removeHighlight();
 					editor.focus();
-					editor.getSelection().selectRanges(
-						[ finder.matchRange.toDomRange() ] );
+					
+					range = finder.matchRange.toDomRange();
+					if ( range )
+						editor.getSelection().selectRanges( [ range ] );
 				}
 
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js	(revision 5348)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js	(revision 5349)
@@ -1,3 +1,3 @@
-/*
+﻿/*
 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -141,37 +141,4 @@
 		},
 
-		// Removes any conflicting styles from within the specified range..
-		removeConflictsFromRange : function ( range, nodeToPreserve )
-		{
-			var style = this,
-				overrides = getOverrides( style ),
-				styleCandidates = [],
-				overrideCandidates = [];
-
-			var walker = new CKEDITOR.dom.walker( range );
-			walker.evaluator = function( node )
-			{
-				if ( node.type == CKEDITOR.NODE_ELEMENT
-						&& ( !nodeToPreserve || !node.equals( nodeToPreserve ) ) )
-				{
-					if ( node.is( style.element ) )
-						styleCandidates.push( node );
-
-					if ( node.getName() in overrides )
-						overrideCandidates.push( node );
-				}
-			};
-			walker.lastForward();
-
-			// First remove from element any style conflictions.
-			for ( var i = styleCandidates.length - 1 ; i >= 0 ; i-- )
-				removeFromElement( style,  styleCandidates[ i ] );
-
-			// Now remove any other element with different name that is
-			// defined to be overriden.
-			for ( i = overrideCandidates.length - 1 ; i >= 0 ; i-- )
-				removeOverrides( overrideCandidates[ i ], overrides[ overrideCandidates[ i ].getName() ] ) ;
-		},
-
 		applyToObject : function( element )
 		{
@@ -575,12 +542,11 @@
 					styleRange.extractContents().appendTo( styleNode );
 
+					// Here we do some cleanup, removing all duplicated
+					// elements from the style element.
+					removeFromInsideElement( this, styleNode );
+
 					// Insert it into the range position (it is collapsed after
-					// extractContents).
+					// extractContents.
 					styleRange.insertNode( styleNode );
-
-					// Remove all style conflicts within the range, including
-					// parents boundaries touched by styleNode.
-					styleRange.enlarge( CKEDITOR.ENLARGE_ELEMENT );
-					this.removeConflictsFromRange( styleRange, styleNode );
 
 					// Let's merge our new style with its neighbors, if possible.
@@ -1006,4 +972,34 @@
 
 		removeEmpty && removeNoAttribsElement( element );
+	}
+
+	// Removes a style from inside an element.
+	function removeFromInsideElement( style, element )
+	{
+		var def = style._.definition,
+			attribs = def.attributes,
+			styles = def.styles,
+			overrides = getOverrides( style );
+
+		var innerElements = element.getElementsByTag( style.element );
+
+		for ( var i = innerElements.count(); --i >= 0 ; )
+			removeFromElement( style,  innerElements.getItem( i ) );
+
+		// Now remove any other element with different name that is
+		// defined to be overriden.
+		for ( var overrideElement in overrides )
+		{
+			if ( overrideElement != style.element )
+			{
+				innerElements = element.getElementsByTag( overrideElement ) ;
+				for ( i = innerElements.count() - 1 ; i >= 0 ; i-- )
+				{
+					var innerElement = innerElements.getItem( i );
+					removeOverrides( innerElement, overrides[ overrideElement ] ) ;
+				}
+			}
+		}
+
 	}
 
