Index: /CKEditor/branches/features/4210/3.1.x/_source/adapters/jquery.js
===================================================================
--- /CKEditor/branches/features/4210/3.1.x/_source/adapters/jquery.js	(revision 4472)
+++ /CKEditor/branches/features/4210/3.1.x/_source/adapters/jquery.js	(revision 4473)
@@ -107,16 +107,34 @@
 			{
 				var $element = jQuery( this ),
-					instance = $element.data( 'ckeditorInstance' ),
+					editor = $element.data( 'ckeditorInstance' ),
+					instanceLock = $element.data( '_ckeditorInstanceLock' ),
 					element = this;
 
-				if ( instance )
+				if ( editor && !instanceLock )
 				{
 					if ( callback )
-						callback.apply( instance, [ this ] );
+						callback.apply( editor, [ this ] );
 				}
-				else if ( $element.data( '_ckeditorInstanceLock' ) )
-				{
-					// Editor is already during creation process, bind our code to the event.
-					CKEDITOR.on( 'instanceReady', function( event )
+				else if ( !instanceLock )
+				{
+					// CREATE NEW INSTANCE
+
+					// Handle config.autoUpdateElement inside this plugin if desired.
+					if ( config.autoUpdateElement
+						|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
+					{
+						config.autoUpdateElementJquery = true;
+					}
+
+					// Always disable config.autoUpdateElement.
+					config.autoUpdateElement = false;
+					$element.data( '_ckeditorInstanceLock', true );
+
+					// Set instance reference in element's data.
+					editor = CKEDITOR.replace( element, config );
+					$element.data( 'ckeditorInstance', editor );
+
+					// Register callback.
+					editor.on( 'instanceReady', function( event )
 					{
 						var editor = event.editor;
@@ -126,29 +144,4 @@
 							if ( !editor.element )
 								return setTimeout( arguments.callee, 100 );
-
-							if ( editor.element.$ == element )
-							{
-								// Run given code.
-								if ( callback )
-									callback.apply( editor, [ element ] );
-							}
-						}, 0 );
-					}, null, null, 9999);
-				}
-				else
-				{
-					// CREATE NEW INSTANCE
-					// Register callback.
-					CKEDITOR.on( 'instanceReady', function( event )
-					{
-						var editor = event.editor;
-						setTimeout( function()
-						{
-							// Delay bit more if editor is still not ready.
-							if ( !editor.element )
-								return setTimeout( arguments.callee, 100 );
-
-							if ( editor.element.$ != element )
-								return;
 
 							// Remove this listener.
@@ -167,5 +160,5 @@
 
 							// Forward destroy event.
-							editor.on( 'destroy', function( event )
+							editor.on( 'destroy', function()
 							{
 								$element.trigger( 'destroy.ckeditor', [ editor ] );
@@ -193,7 +186,4 @@
 							}
 
-							// Set instance reference in element's data.
-							$element.data( 'ckeditorInstance', editor );
-
 							// Garbage collect on destroy.
 							editor.on( 'destroy', function()
@@ -213,18 +203,25 @@
 						}, 0 );
 					}, null, null, 9999);
-
-					// Trigger instance creation.
-
-					// Handle config.autoUpdateElement inside this plugin if desired.
-					if ( config.autoUpdateElement
-						|| ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) )
-					{
-						config.autoUpdateElementJquery = true;
-					}
-
-					// Always disable config.autoUpdateElement.
-					config.autoUpdateElement = false;
-					$element.data( '_ckeditorInstanceLock', true );
-					CKEDITOR.replace( element, config );
+				}
+				else
+				{
+					// Editor is already during creation process, bind our code to the event.
+					CKEDITOR.on( 'instanceReady', function( event )
+					{
+						var editor = event.editor;
+						setTimeout( function()
+						{
+							// Delay bit more if editor is still not ready.
+							if ( !editor.element )
+								return setTimeout( arguments.callee, 100 );
+
+							if ( editor.element.$ == element )
+							{
+								// Run given code.
+								if ( callback )
+									callback.apply( editor, [ element ] );
+							}
+						}, 0 );
+					}, null, null, 9999);
 				}
 			});
