Index: /CKEditor/branches/versions/3.0.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.0.x/CHANGES.html	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/CHANGES.html	(revision 4738)
@@ -100,4 +100,6 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4521">#4521</a> : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4709">#4709</a> : Fixed inconsistent scroll-bar behavior on IE.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4776">#4776</a> : Fixed preview page failed to open when relative URl contains in document.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4812">#4812</a> : Fixed 'Esc' key not working on dialogs in Opera.</li>
 		<li>Updated the following language files:<ul>
 			<li><a href="http://dev.fckeditor.net/ticket/4346">#4346</a> : Dutch;</li>
Index: /CKEditor/branches/versions/3.0.x/_source/core/dom/range.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/core/dom/range.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/core/dom/range.js	(revision 4738)
@@ -307,4 +307,13 @@
 			    || !CKEDITOR.tools.trim( node.getText() )
 			    || node.getParent().hasAttribute( '_fck_bookmark' );
+	}
+
+	var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
+		bookmarkEval = new CKEDITOR.dom.walker.bookmark();
+
+	function nonWhitespaceOrBookmarkEval( node )
+	{
+		// Whitespaces and bookmark nodes are to be ignored.
+		return !whitespaceEval( node ) && !bookmarkEval( node );
 	}
 
@@ -1600,28 +1609,40 @@
 		 * "&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt; Text&lt;/p&gt;", the start editing point is
 		 * "&lt;p&gt;&lt;b&gt;&lt;i&gt;^&lt;/i&gt;&lt;/b&gt; Text&lt;/p&gt;" (inside &lt;i&gt;).
-		 * @param {CKEDITOR.dom.element} targetElement The element into which
-		 *		look for the editing spot.
+		 * @param {CKEDITOR.dom.element} el The element into which look for the
+		 *		editing spot.
 		 */
-		moveToElementEditStart : function( targetElement )
-		{
-			var editableElement;
-
-			while ( targetElement && targetElement.type == CKEDITOR.NODE_ELEMENT )
-			{
-				if ( targetElement.isEditable() )
-					editableElement = targetElement;
-				else if ( editableElement )
-					break ;		// If we already found an editable element, stop the loop.
-
-				targetElement = targetElement.getFirst();
-			}
-
-			if ( editableElement )
-			{
-				this.moveToPosition(editableElement, CKEDITOR.POSITION_AFTER_START);
-				return true;
-			}
-			else
-				return false;
+		moveToElementEditStart : function( el )
+		{
+			var isEditable;
+
+			while ( el && el.type == CKEDITOR.NODE_ELEMENT )
+			{
+				isEditable = el.isEditable();
+
+				// If an editable element is found, move inside it.
+				if ( isEditable )
+					this.moveToPosition( el, CKEDITOR.POSITION_AFTER_START );
+				// Stop immediately if we've found a non editable inline element (e.g <img>).
+				else if ( CKEDITOR.dtd.$inline[ el.getName() ] )
+				{
+					this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START );
+					return true;
+				}
+
+				// Non-editable non-inline elements are to be bypassed, getting the next one.
+				if ( CKEDITOR.dtd.$empty[ el.getName() ] )
+					el = el.getNext( nonWhitespaceOrBookmarkEval );
+				else
+					el = el.getFirst( nonWhitespaceOrBookmarkEval );
+
+				// Stop immediately if we've found a text node.
+				if ( el && el.type == CKEDITOR.NODE_TEXT )
+				{
+					this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START );
+					return true;
+				}
+			}
+
+			return isEditable;
 		},
 
Index: /CKEditor/branches/versions/3.0.x/_source/core/dom/walker.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/core/dom/walker.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/core/dom/walker.js	(revision 4738)
@@ -48,5 +48,5 @@
 				return ( ( !movingOut || !limitLTR.equals( node ) )
 					&& ( !blockerLTR || !node.equals( blockerLTR ) )
-					&& ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );
+					&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
 			};
 		}
@@ -63,5 +63,5 @@
 				return ( ( !movingOut || !limitRTL.equals( node ) )
 					&& ( !blockerRTL || !node.equals( blockerRTL ) )
-					&& ( node.type != CKEDITOR.NODE_ELEMENT || node.getName() != 'body' ) );
+					&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
 			};
 		}
@@ -79,5 +79,5 @@
 					return false;
 
-				return userGuard( node );
+				return userGuard( node, movingOut );
 			};
 		}
@@ -397,5 +397,5 @@
 
 	/**
-	 * Whether the node contains only white-spaces characters.
+	 * Whether the node is a text node containing only whitespaces characters.
 	 * @param isReject
 	 */
Index: /CKEditor/branches/versions/3.0.x/_source/core/dtd.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/core/dtd.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/core/dtd.js	(revision 4738)
@@ -66,4 +66,6 @@
 		 */
 		$block : block,
+
+		$inline : L,	// Just like span.
 
 		$body : X({script:1}, block),
Index: /CKEditor/branches/versions/3.0.x/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/plugins/dialog/plugin.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/plugins/dialog/plugin.js	(revision 4738)
@@ -352,4 +352,6 @@
 			{
 				CKEDITOR.document.removeListener( 'keydown', focusKeydownHandler );
+				if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
+					CKEDITOR.document.removeListener( 'keypress', focusKeyPressHandler );
 			} );
 		this.on( 'iframeAdded', function( evt )
@@ -640,5 +642,5 @@
 
 				element.on( 'keydown', accessKeyDownHandler );
-				element.on( 'keyup', accessKeyUpHandler );
+				element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
 
 				// Prevent some keys from bubbling up. (#4269)
@@ -770,6 +772,5 @@
 				// Remove access key handlers.
 				element.removeListener( 'keydown', accessKeyDownHandler );
-				element.removeListener( 'keyup', accessKeyUpHandler );
-				element.removeListener( 'keypress', accessKeyUpHandler );
+				element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
 
 				// Remove bubbling-prevention handler. (#4269)
@@ -1831,6 +1832,9 @@
 
 		keyProcessor = keyProcessor[keyProcessor.length - 1];
-		keyProcessor.keyup && keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
-		evt.data.preventDefault();
+		if ( keyProcessor.keyup )
+		{
+			keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
+			evt.data.preventDefault();
+		}
 	};
 
Index: /CKEditor/branches/versions/3.0.x/_source/plugins/domiterator/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/plugins/domiterator/plugin.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/plugins/domiterator/plugin.js	(revision 4738)
@@ -213,9 +213,10 @@
 				if ( ( closeRange || isLast ) && range )
 				{
-					var boundaryNodes = range.getBoundaryNodes();
+					var boundaryNodes = range.getBoundaryNodes(),
+						startPath = new CKEDITOR.dom.elementPath( range.startContainer );
 
 					// Drop the range if it only contains bookmark nodes, and is
 					// not because of the original collapsed range. (#4087,#4450)
-					if ( !this.range.collapsed
+					if ( boundaryNodes.startNode.getParent().equals( startPath.blockLimit )
 						 && isBookmark( boundaryNodes.startNode ) && isBookmark( boundaryNodes.endNode ) )
 					{
@@ -243,5 +244,5 @@
 				}
 
-				var startPath = new CKEDITOR.dom.elementPath( range.startContainer );
+				startPath = new CKEDITOR.dom.elementPath( range.startContainer );
 				var startBlockLimit = startPath.blockLimit,
 					checkLimits = { div : 1, th : 1, td : 1 };
Index: /CKEditor/branches/versions/3.0.x/_source/plugins/image/dialogs/image.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/plugins/image/dialogs/image.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/plugins/image/dialogs/image.js	(revision 4738)
@@ -807,15 +807,13 @@
 														{
 															if ( value )
-																element.setStyle( 'border', CKEDITOR.tools.cssLength( value ) + ' solid' );
+															{
+																element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) );
+																element.setStyle( 'border-style', 'solid' );
+															}
 															else if ( !value && this.isChanged() )
 															{
-																if( CKEDITOR.env.ie )
-																{
-																	element.removeStyle( 'border-width' );
-																	element.removeStyle( 'border-style' );
-																	element.removeStyle( 'border-color' );
-																}
-																else
-																	element.removeStyle( 'border' );
+																element.removeStyle( 'border-width' );
+																element.removeStyle( 'border-style' );
+																element.removeStyle( 'border-color' );
 															}
 
@@ -826,5 +824,7 @@
 														{
 															element.removeAttribute( 'border' );
-															element.removeStyle( 'border' );
+															element.removeStyle( 'border-width' );
+															element.removeStyle( 'border-style' );
+															element.removeStyle( 'border-color' );
 														}
 													}
Index: /CKEditor/branches/versions/3.0.x/_source/plugins/preview/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.0.x/_source/plugins/preview/plugin.js	(revision 4737)
+++ /CKEditor/branches/versions/3.0.x/_source/plugins/preview/plugin.js	(revision 4738)
@@ -76,4 +76,5 @@
 			if ( !isCustomDomain )
 			{
+				oWindow.document.open();
 				oWindow.document.write( sHTML );
 				oWindow.document.close();
