Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4555)
@@ -57,4 +57,30 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4625">#4625</a> : Fixed editor stay visible in a div with style 'visibility:hidden'.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4621">#4621</a> : Fixed clicking below table cause a empty table been generated.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3373">#3373</a> : Fixed empty context menu when there's no menu item at all.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4473">#4473</a> : Fixed setting rules on the same element tag name throw error.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4514">#4514</a> : Fixed press 'Back' button breaks wysiwyg editing mode.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4542">#4542</a> : Fixed unable to access buttons using tab key in Safari and Opera.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4577">#4577</a> : Fixed relative link url is broken after opening 'Link' dialog.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4597">#4597</a> : Fixed custom style with same attribute name but different attribute value doesn't work.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4651">#4651</a> : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4654">#4654</a> : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3950">#3950</a> : Fixed table column insertion incorrect when selecting empty cell area.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3912">#3912</a> : Fixed UIColor not working in IE when page has more than 30+ editors.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4031">#4031</a> : Fixed mouse cursor on toolbar combo has more than 3 shapes.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4041">#4041</a> : Fixed open context menu on multiple cells to remove them result in only one removed.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4185">#4185</a> : Fixed resize handler effect doesn't affect flash object on output.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4196">#4196</a> : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4200">#4200</a> : Fixed unable to insert 'password' type filed with attributes.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4530">#4530</a> : Fixed context menu couldn't open in Opera.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4536">#4536</a> : Fixed keyboard navigation doesn't work at all in IE quirks mode.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4584">#4584</a> : Fixed updated link Target field is not updating when updating to certian values.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4603">#4603</a> : Fixed unable to disable submenu items in contextmenu.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4672">#4672</a> : Fixed unable to redo the insertion of horizontal line.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4677">#4677</a> : Fixed 'Tab' key is trapped by hidden dialog elements.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4073">#4073</a> : Fixed insert template with replace option could result in empty document.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4455">#4455</a> : Fixed unable to start editing when image inside document not loaded.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4517">#4517</a> : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3165">#3165</a> : Fixed enter key in empty list item before nested one result in collapsed line.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4527">#4527</a> : Fixed checkbox generate invalid 'checked' attribute.</li>
 	</ul>
 	<h3>
@@ -66,4 +92,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4194">#4194</a> : Added support for using multiple css style sheets within the editor.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4210">#4210</a> : Introducing the CKEditor plugin for jQuery (the jQuery adapter).</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4343">#4343</a> : Added config option 'browserContextMenuOnCtrl' for 'contextmenu' plugin.</li>
 	</ul>
 	<p>
Index: /CKEditor/branches/versions/3.1.x/_dev/packager/packagefilegen_full.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_dev/packager/packagefilegen_full.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_dev/packager/packagefilegen_full.html	(revision 4555)
@@ -106,5 +106,5 @@
 			<label for="editor1">
 				Editor 1:</label><br />
-			<textarea name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+			<textarea name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 			<script type="text/javascript">
 			//<![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/api.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/api.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/api.html	(revision 4555)
@@ -96,5 +96,5 @@
 		This sample shows how to use the CKeditor JavaScript API to interact with the editor
 		at runtime.</p>
-		<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+		<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 		<script type="text/javascript">
 		//<![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/api_dialog.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/api_dialog.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/api_dialog.html	(revision 4555)
@@ -105,5 +105,5 @@
 			<li><strong>Create a custom dialog</strong> ("My Dialog" button).</li>
 		</ol>
-		<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+		<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 		<script type="text/javascript">
 		//<![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/enterkey.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/enterkey.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/enterkey.html	(revision 4555)
@@ -63,5 +63,5 @@
 			<p>
 				<br />
-				<textarea id="editor1" name="editor1" rows="10" cols="80">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.</textarea>
+				<textarea id="editor1" name="editor1" rows="10" cols="80">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea>
 			</p>
 			<p>
Index: /CKEditor/branches/versions/3.1.x/_samples/replacebyclass.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/replacebyclass.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/replacebyclass.html	(revision 4555)
@@ -15,5 +15,5 @@
 				<label for="editor1">
 					Editor 1:</label><br />
-				<textarea id="editor1" name="editor1" class="ckeditor" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor1" name="editor1" class="ckeditor" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 			</p>
 			<p>
@@ -28,10 +28,10 @@
     &lt;label for="editor1"&gt;
       Editor 1:&lt;/label&gt;&lt;br /&gt;
-    &lt;textarea id="editor1" name="editor1" <b>class="ckeditor"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
+    &lt;textarea id="editor1" name="editor1" <b>class="ckeditor"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
   &lt;/p&gt;
   &lt;p&gt;
     &lt;label for="editor2"&gt;
       Editor 2:&lt;/label&gt;&lt;br /&gt;
-    &lt;textarea id="editor2" name="editor2" <b>class="ckeditor"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
+    &lt;textarea id="editor2" name="editor2" <b>class="ckeditor"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
   &lt;/p&gt;
   &lt;p&gt;
Index: /CKEditor/branches/versions/3.1.x/_samples/replacebycode.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/replacebycode.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/replacebycode.html	(revision 4555)
@@ -15,5 +15,5 @@
 				<label for="editor1">
 					Editor 1:</label><br />
-				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -33,5 +33,5 @@
 				<label for="editor2">
 					Editor 2:</label><br />
-				<textarea id="editor2" name="editor2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor2" name="editor2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -59,5 +59,5 @@
     &lt;label for="editor1"&gt;
       Editor 1:&lt;/label&gt;&lt;br /&gt;
-    &lt;textarea <b>name="editor1"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
+    &lt;textarea <b>name="editor1"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
     &lt;script type="text/javascript"&gt;
     //&lt;![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/skins.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/skins.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/skins.html	(revision 4555)
@@ -14,5 +14,5 @@
 			<p>
 				"Kama" skin:<br />
-				<textarea id="editor_kama" name="editor_kama" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor_kama" name="editor_kama" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -28,5 +28,5 @@
 			<p>
 				"Office 2003" skin:<br />
-				<textarea id="editor_office2003" name="editor_office2003" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor_office2003" name="editor_office2003" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -42,5 +42,5 @@
 			<p>
 				"V2" skin:<br />
-				<textarea id="editor_v2" name="editor_v2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor_v2" name="editor_v2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/ui_color.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/ui_color.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/ui_color.html	(revision 4555)
@@ -14,5 +14,5 @@
 		<form action="sample_posteddata.php" method="post">
 			<p>
-				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -34,5 +34,5 @@
 			</p>
 			<p>
-				<textarea id="editor2" name="editor2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor2" name="editor2" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
@@ -65,5 +65,5 @@
     &lt;label for="editor1"&gt;
       Editor 1:&lt;/label&gt;&lt;br /&gt;
-    &lt;textarea <b>name="editor1"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
+    &lt;textarea <b>name="editor1"</b> rows="10" cols="80"&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/textarea&gt;
     &lt;script type="text/javascript"&gt;
     //&lt;![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_samples/ui_languages.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/_samples/ui_languages.html	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_samples/ui_languages.html	(revision 4555)
@@ -46,5 +46,5 @@
 			</p>
 			<p>
-				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
+				<textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 				<script type="text/javascript">
 				//<![CDATA[
Index: /CKEditor/branches/versions/3.1.x/_source/core/dom/element.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/dom/element.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/core/dom/element.js	(revision 4555)
@@ -1,3 +1,3 @@
-﻿/*
+/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -426,6 +426,11 @@
 
 						case 'checked':
-							return this.$.checked;
-							break;
+						{
+							var attr = this.$.attributes.getNamedItem( name ),
+								attrValue = attr.specified ? attr.nodeValue     // For value given by parser.
+															 : this.$.checked;  // For value created via DOM interface.
+							
+							return attrValue ? 'checked' : null;
+						}
 
 						case 'style':
@@ -628,4 +633,5 @@
 		/**
 		 * Gets the first child node of this element.
+		 * @param {Function} evaluator Filtering the result node.
 		 * @returns {CKEDITOR.dom.node} The first child node or null if not
 		 *		available.
@@ -635,8 +641,12 @@
 		 * alert( first.getName() );  // "b"
 		 */
-		getFirst : function()
-		{
-			var $ = this.$.firstChild;
-			return $ ? new CKEDITOR.dom.node( $ ) : null;
+		getFirst : function( evaluator )
+		{
+			var first = this.$.firstChild,
+				retval = first && new CKEDITOR.dom.node( first );
+			if ( retval && evaluator && !evaluator( retval ) )
+				retval = retval.getNext( evaluator );
+
+			return retval;
 		},
 
@@ -723,6 +733,6 @@
 				{
 					attribute = otherAttribs[ i ];
-
-					if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != '_cke_expando' ) ) && attribute.nodeValue != thisAttribs.getAttribute( attribute.nodeName ) )
+					if ( attribute.specified && attribute.nodeName != '_cke_expando'
+							&& attribute.nodeValue != this.getAttribute( attribute.nodeName ) )
 						return false;
 				}
@@ -740,5 +750,22 @@
 		isVisible : function()
 		{
-			return this.$.offsetWidth && ( this.$.style.visibility != 'hidden' );
+			var isVisible = !!this.$.offsetHeight && this.getComputedStyle( 'visibility' ) != 'hidden',
+				elementWindow,
+				elementWindowFrame;
+
+			// Webkit and Opera report non-zero offsetHeight despite that
+			// element is inside an invisible iframe. (#4542)
+			if ( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera ) )
+			{
+				elementWindow = this.getWindow();
+
+				if ( !elementWindow.equals( CKEDITOR.document.getWindow() )
+						&& ( elementWindowFrame = elementWindow.$.frameElement ) )
+				{
+					isVisible = new CKEDITOR.dom.element( elementWindowFrame ).isVisible();
+				}
+			}
+
+			return isVisible;
 		},
 
@@ -1307,14 +1334,20 @@
 				var attribute = attributes[n];
 
+				// Lowercase attribute name hard rule is broken for
+				// some attribute on IE, e.g. CHECKED.
+				var attrName = attribute.nodeName.toLowerCase(),
+					attrValue;
+
+				// We can set the type only once, so do it with the proper value, not copying it.
+				if ( attrName in skipAttributes )
+					continue;
+
+				if( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) )
+					dest.setAttribute( attrName, attrValue );
 				// IE BUG: value attribute is never specified even if it exists.
-				if ( attribute.specified ||
-				  ( CKEDITOR.env.ie && attribute.nodeValue && attribute.nodeName.toLowerCase() == 'value' ) )
-				{
-					var attrName = attribute.nodeName;
-					// We can set the type only once, so do it with the proper value, not copying it.
-					if ( attrName in skipAttributes )
-						continue;
-
-					var attrValue = this.getAttribute( attrName );
+				else if ( attribute.specified ||
+				  ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) )
+				{
+					attrValue = this.getAttribute( attrName );
 					if ( attrValue === null )
 						attrValue = attribute.nodeValue;
Index: /CKEditor/branches/versions/3.1.x/_source/core/dom/walker.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/dom/walker.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/core/dom/walker.js	(revision 4555)
@@ -409,3 +409,23 @@
 		};
 	};
+
+	/**
+	 * Whether the node is invisible in wysiwyg mode.
+	 * @param isReject
+	 */
+	CKEDITOR.dom.walker.invisible = function( isReject )
+	{
+		var whitespace = CKEDITOR.dom.walker.whitespaces();
+		return function( node )
+		{
+			// Nodes that take no spaces in wysiwyg:
+			// 1. White-spaces but not including NBSP;
+			// 2. Empty inline elements, e.g. <b></b> we're checking here
+			// 'offsetHeight' instead of 'offsetWidth' for properly excluding
+			// all sorts of empty paragraph, e.g. <br />.
+			var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
+			return isReject ^ isInvisible;
+		};
+	};
+
 })();
Index: /CKEditor/branches/versions/3.1.x/_source/core/dtd.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/dtd.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/core/dtd.js	(revision 4555)
@@ -145,5 +145,5 @@
         select : {optgroup:1,option:1},
         font : L,
-        ins : P,
+        ins : L,
         menu : Q,
         abbr : L,
@@ -180,5 +180,5 @@
         applet : O,
         dl : {dt:1,dd:1},
-        del : P,
+        del : L,
         isindex : {},
         fieldset : X({legend:1},K),
Index: /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/element.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/element.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/element.js	(revision 4555)
@@ -36,5 +36,5 @@
 
 	var dtd			= CKEDITOR.dtd,
-		isBlockLike	= !!( dtd.$block[ name ] || dtd.$listItem[ name ] || dtd.$tableContent[ name ] || dtd.$nonEditable ),
+		isBlockLike	= !!( dtd.$block[ name ] || dtd.$listItem[ name ] || dtd.$tableContent[ name ] || dtd.$nonEditable[ name ] || name == 'br' ),
 		isEmpty		= !!dtd.$empty[ name ];
 
Index: /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/filter.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/filter.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/core/htmlparser/filter.js	(revision 4555)
@@ -128,4 +128,7 @@
 	function addItemsToList( list, items, priority )
 	{
+		if( typeof items == 'function' )
+			items = [ items ];
+
 		var i, j,
 			listLength = list.length,
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/contextmenu/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/contextmenu/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/contextmenu/plugin.js	(revision 4555)
@@ -120,5 +120,6 @@
 			}
 
-			menu.show( offsetParent, corner || ( editor.lang.dir == 'rtl' ? 2 : 1 ), offsetX, offsetY );
+			// Don't show context menu with zero items.
+			menu.items.length && menu.show( offsetParent, corner || ( editor.lang.dir == 'rtl' ? 2 : 1 ), offsetX, offsetY );
 		}
 	},
@@ -126,9 +127,64 @@
 	proto :
 	{
-		addTarget : function( element )
-		{
+		addTarget : function( element, nativeContextMenuOnCtrl )
+		{
+			// Opera doesn't support 'contextmenu' event, we have duo approaches employed here:
+			// 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser
+			//  option 'Allow script to detect context menu/right click events' to be always turned on.
+			// 2. Considering the fact that ctrl/meta key is not been occupied
+			//  for multiple range selecting (like Gecko), we use this key
+			//  combination as a fallback for triggering context-menu. (#4530)
+			if ( CKEDITOR.env.opera )
+			{
+				var contextMenuOverrideButton;
+				element.on( 'mousedown', function( evt )
+				{
+					evt = evt.data;
+					if( evt.$.button != 2 )
+					{
+						if ( evt.getKeystroke() == CKEDITOR.CTRL + 1 )
+							element.fire( 'contextmenu', evt );
+						return;
+					}
+
+					if ( nativeContextMenuOnCtrl
+						 && ( evt.$.ctrlKey || evt.$.metaKey ) )
+						return;
+
+					var target = evt.getTarget();
+
+					if( !contextMenuOverrideButton )
+					{
+						var ownerDoc =  target.getDocument();
+						contextMenuOverrideButton = ownerDoc.createElement( 'input' ) ;
+						contextMenuOverrideButton.$.type = 'button' ;
+						ownerDoc.getBody().append( contextMenuOverrideButton ) ;
+					}
+
+					contextMenuOverrideButton.setAttribute( 'style', 'position:absolute;top:' + ( evt.$.clientY - 2 ) +
+						'px;left:' + ( evt.$.clientX - 2 ) +
+						'px;width:5px;height:5px;opacity:0.01' );
+
+				} );
+
+				element.on( 'mouseup', function ( evt )
+				{
+					if ( contextMenuOverrideButton )
+					{
+						contextMenuOverrideButton.remove();
+						contextMenuOverrideButton = undefined;
+						// Simulate 'contextmenu' event.
+						element.fire( 'contextmenu', evt.data );
+					}
+				} );
+			}
+
 			element.on( 'contextmenu', function( event )
 				{
 					var domEvent = event.data;
+
+					if ( nativeContextMenuOnCtrl
+						 && ( domEvent.$.ctrlKey || domEvent.$.metaKey ) )
+						return;
 
 					// Cancel the browser context menu.
@@ -161,18 +217,13 @@
 });
 
-// Fix the "contextmenu" event for DOM elements.
-// We may do this if we identify browsers that don't support the context meny
-// event on element directly. Leaving here for reference.
-//if ( <specific browsers> )
-//{
-//	CKEDITOR.dom.element.prototype.on = CKEDITOR.tools.override( CKEDITOR.dom.element.prototype.on, function( originalOn )
-//		{
-//			return function( eventName )
-//				{
-//					if ( eventName != 'contextmenu' )
-//						return originalOn.apply( this, arguments );
-//
-//					// TODO : Implement the fix.
-//				};
-//		});
-//}
+/**
+ * Whether preserve browser native context menu when 'Ctrl' or 'Meta' key
+ * is pressed while open context menu.
+ * @name CKEDITOR.config.browserContextMenuOnCtrl
+ * @type Boolean
+ * @default true
+ * @example
+ *  config.browserContextMenuOnCtrl = false;
+ */
+
+
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4555)
@@ -279,4 +279,6 @@
 		}
 
+		var processed;
+
 		function focusKeydownHandler( evt )
 		{
@@ -285,6 +287,7 @@
 				return;
 
-			var keystroke = evt.data.getKeystroke(),
-				processed = false;
+			var keystroke = evt.data.getKeystroke();
+
+			processed = 0;
 			if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 )
 			{
@@ -305,5 +308,5 @@
 				}
 
-				processed = true;
+				processed = 1;
 			}
 			else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode )
@@ -312,5 +315,5 @@
 				me._.tabBarMode = true;
 				me._.tabs[ me._.currentTabId ][ 0 ].focus();
-				processed = true;
+				processed = 1;
 			}
 			else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode )
@@ -320,5 +323,5 @@
 				me.selectPage( nextId );
 				me._.tabs[ nextId ][ 0 ].focus();
-				processed = true;
+				processed = 1;
 			}
 
@@ -330,8 +333,17 @@
 		}
 
+		function focusKeyPressHandler( evt )
+		{
+			processed && evt.data.preventDefault();
+		}
+
 		// Add the dialog keyboard handlers.
 		this.on( 'show', function()
 			{
 				CKEDITOR.document.on( 'keydown', focusKeydownHandler, this, null, 0 );
+				// Some browsers instead, don't cancel key events in the keydown, but in the
+				// keypress. So we must do a longer trip in those cases. (#4531)
+				if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
+					CKEDITOR.document.on( 'keypress', focusKeyPressHandler, this );
 
 				if ( CKEDITOR.env.ie6Compat )
@@ -453,5 +465,5 @@
 		this.isFocusable = function()
 		{
-			return true;
+			return !( element.getAttribute( 'disabled' ) || !element.isVisible() )
 		};
 		this.focus = function()
@@ -581,6 +593,10 @@
 		show : function()
 		{
-			if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
-				this._.editor.getSelection().lock();
+			var editor = this._.editor;
+			if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
+			{
+				var selection = editor.getSelection();
+				selection && selection.lock();
+			}
 
 			// Insert the dialog's element to the root document.
@@ -768,5 +784,8 @@
 
 				if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
-					editor.getSelection().unlock( true );
+				{
+					var selection = editor.getSelection();
+					selection && selection.unlock( true );
+				}
 			}
 			else
@@ -1662,9 +1681,11 @@
 		if ( !coverElement )
 		{
+			var backgroundColorStyle = editor.config.dialog_backgroundCoverColor || 'white';
+
 			var html = [
 					'<div style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),
 					'; z-index: ', editor.config.baseFloatZIndex,
 					'; top: 0px; left: 0px; ',
-					'background-color: ', editor.config.dialog_backgroundCoverColor || 'white',
+					( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ),
 					'" id="cke_dialog_background_cover">'
 				];
@@ -1674,5 +1695,6 @@
 			{
 				// Support for custom document.domain in IE.
-				var isCustomDomain = CKEDITOR.env.isCustomDomain();
+				var isCustomDomain = CKEDITOR.env.isCustomDomain(),
+					iframeHtml = '<html><body style=\\\'background-color:' + backgroundColorStyle + ';\\\'></body></html>';
 
 				html.push(
@@ -1683,13 +1705,10 @@
 						' src="javascript:' );
 
-				html.push(
-						isCustomDomain ?
-							'void((function(){' +
+				html.push( 'void((function(){' +
 								'document.open();' +
-								'document.domain=\'' + document.domain + '\';' +
+								( isCustomDomain ? 'document.domain=\'' + document.domain + '\';' : '' ) +
+								'document.write( \'' + iframeHtml + '\' );' +
 								'document.close();' +
-							'})())'
-						:
-							'\'\'' );
+							'})())' );
 
 				html.push(
@@ -2449,5 +2468,5 @@
 		isVisible : function()
 		{
-			return !!this.getInputElement().$.offsetHeight;
+			return this.getInputElement().isVisible();
 		},
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/dialogui/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/dialogui/plugin.js	(revision 4555)
@@ -839,5 +839,5 @@
 				isVisible : function()
 				{
-					return !!this.getElement().$.firstChild.offsetHeight;
+					return this.getElement().getFirst().isVisible();
 				},
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/enterkey/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/enterkey/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/enterkey/plugin.js	(revision 4555)
@@ -102,9 +102,10 @@
 		{
 			// If the next block is an <li> with another list tree as the first
-			// child, we'll need to append a placeholder or the list item
+			// child, we'll need to append a filler (<br>/NBSP) or the list item
 			// wouldn't be editable. (#1420)
-			if ( nextBlock.is( 'li' ) && ( node = nextBlock.getFirst() )
-					&& node.is && node.is( 'ul', 'ol') )
-				nextBlock.insertBefore( doc.createText( '\xa0' ), node );
+			if ( nextBlock.is( 'li' )
+				 && ( node = nextBlock.getFirst( CKEDITOR.dom.walker.invisible( true ) ) )
+				 && node.is && node.is( 'ul', 'ol' ) )
+				( CKEDITOR.env.ie ? doc.createText( '\xa0' ) : doc.createElement( 'br' ) ).insertBefore( node );
 
 			// Move the selection to the end block.
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/fakeobjects/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/fakeobjects/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/fakeobjects/plugin.js	(revision 4555)
@@ -26,9 +26,9 @@
 					{
 						// Get the width from the style.
-						var match = /(?:^|\s)width\s*:\s*(\d+)/.exec( style ),
+						var match = /(?:^|\s)width\s*:\s*(\d+)/i.exec( style ),
 							width = match && match[1];
 
 						// Get the height from the style.
-						match = /(?:^|\s)height\s*:\s*(\d+)/.exec( style );
+						match = /(?:^|\s)height\s*:\s*(\d+)/i.exec( style );
 						var height = match && match[1];
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/floatpanel/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/floatpanel/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/floatpanel/plugin.js	(revision 4555)
@@ -150,5 +150,5 @@
 					focused.on( 'blur', function( ev )
 						{
-							if ( CKEDITOR.env.ie && !this.allowBlur() )
+							if ( !this.allowBlur() )
 								return;
 
@@ -240,8 +240,6 @@
 									}
 								}
-								if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )
-									iframe.focus();
-								else
-									iframe.$.contentWindow.focus();
+								
+								iframe.$.contentWindow.focus();
 
 								// We need this get fired manually because of unfired focus() function.
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/checkbox.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/checkbox.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/checkbox.js	(revision 4555)
@@ -80,12 +80,15 @@
 						setup : function( element )
 						{
-							this.setValue( element.getAttribute( 'value' ) || '' );
+							var value = element.getAttribute( 'value' );
+							// IE Return 'on' as default attr value.
+							this.setValue(  CKEDITOR.env.ie && value == 'on' ? '' : value  );
 						},
 						commit : function( data )
 						{
-							var element = data.element;
+							var element = data.element,
+								value = this.getValue();
 
-							if ( this.getValue() )
-								element.setAttribute( 'value', this.getValue() );
+							if ( value && !( CKEDITOR.env.ie && value == 'on' ) )
+								element.setAttribute( 'value', value );
 							else
 								element.removeAttribute( 'value' );
@@ -116,5 +119,6 @@
 									var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"'
 										   + ( isChecked ? ' checked="checked"' : '' )
-										   + '></input>', editor.document );
+										   + '/>', editor.document );
+
 									element.copyAttributes( replace, { type : 1, checked : 1 } );
 									replace.replace( element );
@@ -125,6 +129,7 @@
 							else
 							{
-								if ( this.getValue() )
-									element.setAttribute( 'checked', this.getValue() );
+								var value = this.getValue();
+								if ( value )
+									element.setAttribute( 'checked', 'checked' );
 								else
 									element.removeAttribute( 'checked' );
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/textfield.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/textfield.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/forms/dialogs/textfield.js	(revision 4555)
@@ -180,5 +180,5 @@
 									replace.replace( element );
 									editor.getSelection().selectElement( replace );
-									data.element = element;
+									data.element = replace;
 								}
 							}
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/forms/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/forms/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/forms/plugin.js	(revision 4555)
@@ -161,4 +161,28 @@
 					}
 				});
+		}
+	},
+
+	afterInit : function( editor )
+	{
+		// Cleanup certain IE form elements default values.
+		if( CKEDITOR.env.ie )
+		{
+			var dataProcessor = editor.dataProcessor,
+				htmlFilter = dataProcessor && dataProcessor.htmlFilter;
+
+			htmlFilter && htmlFilter.addRules(
+			{
+				elements :
+				{
+					input : function( input )
+					{
+						var attrs = input.attributes,
+							type = attrs.type;
+						if( type == 'checkbox' || type == 'radio' )
+							attrs.value == 'on' && delete attrs.value;
+					}
+				}
+			} );
 		}
 	},
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/horizontalrule/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/horizontalrule/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/horizontalrule/plugin.js	(revision 4555)
@@ -12,4 +12,5 @@
 	var horizontalruleCmd =
 	{
+		canUndo : false,    // The undo snapshot will be handled by 'insertElement'.
 		exec : function( editor )
 		{
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/link/dialogs/link.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/link/dialogs/link.js	(revision 4555)
@@ -306,5 +306,5 @@
 										{
 											if ( data.url )
-												this.setValue( data.url.protocol );
+												this.setValue( data.url.protocol || '' );
 										},
 										commit : function( data )
@@ -1107,4 +1107,7 @@
 					if ( data.target.type != 'notSet' && data.target.name )
 						attributes.target = data.target.name;
+					else
+						removeAttributes.push( 'target' );
+
 					removeAttributes.push( '_cke_pa_onclick', 'onclick' );
 				}
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/list/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/list/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/list/plugin.js	(revision 4555)
@@ -357,5 +357,4 @@
 		compensateBrs();
 
-		var rootParent = groupObj.root.getParent();
 		docFragment.replace( groupObj.root );
 	}
@@ -446,4 +445,6 @@
 				{
 					var path = new CKEDITOR.dom.elementPath( block ),
+						pathElements = path.elements,
+						pathElementsCount = pathElements.length,
 						listNode = null,
 						processedFlag = false,
@@ -452,8 +453,8 @@
 
 					// First, try to group by a list ancestor.
-					for ( var i = 0 ; i < path.elements.length &&
-						  ( element = path.elements[ i ] ) && !element.equals( blockLimit ); i++ )
-					{
-						if ( listNodeNames[ element.getName() ] )
+					for ( var i = pathElementsCount - 1; i >= 0 && ( element = pathElements[ i ] ); i-- )
+					{
+						if ( listNodeNames[ element.getName() ]
+							 && blockLimit.contains( element ) )     // Don't leak outside block limit (#3940).
 						{
 							// If we've encountered a list inside a block limit
@@ -539,4 +540,63 @@
 	};
 
+	var dtd = CKEDITOR.dtd;
+	var tailNbspRegex = /[\t\r\n ]*(?:&nbsp;|\xa0)$/;
+	
+	function indexOfFirstChildElement( element, tagNameList )
+	{
+		var children = element.children,
+			child,
+			length = children.length;
+		for ( var i = 0; i < length; i++ )
+		{
+			child = children[ i ];
+			if( child.name && ( child.name in tagNameList ) )
+				return i;
+		}
+	}
+
+	function getExtendNestedListFilter( isHtmlFilter )
+	{
+		// An element filter function that corrects nested list start in an empty
+		// list item for better displaying/outputting. (#3165)
+		return function( listItem )
+		{
+			var children = listItem.children,
+				firstNestedListIndex = indexOfFirstChildElement( listItem, dtd.$list ),
+				firstNestedList = children[ firstNestedListIndex ],
+				nodeBefore = firstNestedList && firstNestedList.previous,
+				tailNbspmatch;
+
+			if( nodeBefore
+				&& ( nodeBefore.name && nodeBefore.name == 'br'
+					|| nodeBefore.value && ( tailNbspmatch = nodeBefore.value.match( tailNbspRegex ) ) ) )
+			{
+				var fillerNode = nodeBefore;
+
+				// Always use 'nbsp' as filler node if we found a nested list appear
+				// in front of a list item.
+				if ( !( tailNbspmatch && tailNbspmatch.index ) && fillerNode == children[ 0 ] )
+					children[ 0 ] = ( isHtmlFilter || CKEDITOR.env.ie ) ?
+					                 new CKEDITOR.htmlParser.text( '\xa0' ) :
+									 new CKEDITOR.htmlParser.element( 'br', {} );
+
+				// Otherwise the filler is not needed anymore.
+				else if ( fillerNode.name == 'br' )
+					children.splice( firstNestedListIndex - 1, 1 );
+				else
+					fillerNode.value = fillerNode.value.replace( tailNbspRegex, '' );
+			}
+
+		};
+	}
+
+	var defaultListDataFilterRules = { elements : {} };
+	for( var i in dtd.$listItem )
+		defaultListDataFilterRules.elements[ i ] = getExtendNestedListFilter();
+
+	var defaultListHtmlFilterRules = { elements : {} };
+	for( i in dtd.$listItem )
+		defaultListHtmlFilterRules.elements[ i ] = getExtendNestedListFilter( true );
+
 	CKEDITOR.plugins.add( 'list',
 	{
@@ -566,4 +626,14 @@
 		},
 
+		afterInit : function ( editor )
+		{
+			var dataProcessor = editor.dataProcessor;
+			if( dataProcessor )
+			{
+				dataProcessor.dataFilter.addRules( defaultListDataFilterRules );
+				dataProcessor.htmlFilter.addRules( defaultListHtmlFilterRules );
+			}
+		},
+
 		requires : [ 'domiterator' ]
 	} );
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js	(revision 4555)
@@ -68,9 +68,9 @@
 				var menu = this._.subMenu,
 					item = this.items[ index ],
-					subItems = item.getItems && item.getItems();
+					subItemDefs = item.getItems && item.getItems();
 
 				// If this item has no subitems, we just hide the submenu, if
 				// available, and return back.
-				if ( !subItems )
+				if ( !subItemDefs )
 				{
 					this._.panel.hideChild();
@@ -90,7 +90,12 @@
 
 				// Add all submenu items to the menu.
-				for ( var itemName in subItems )
-				{
-					menu.add( this.editor.getMenuItem( itemName ) );
+				for ( var subItemName in subItemDefs )
+				{
+					var subItem = this.editor.getMenuItem( subItemName );
+					if ( subItem )
+					{
+						subItem.state = subItemDefs[ subItemName ];
+						menu.add( subItem );
+					}
 				}
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/richcombo/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/richcombo/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/richcombo/plugin.js	(revision 4555)
@@ -284,5 +284,5 @@
 			var textElement = this.document.getById( 'cke_' + this.id + '_text' );
 
-			if ( !value )
+			if ( !( value || text ) )
 			{
 				text = this.label;
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/selection/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/selection/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/selection/plugin.js	(revision 4555)
@@ -1,3 +1,3 @@
-﻿/*
+/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -153,6 +153,14 @@
 						doc.on( 'mousedown', disableSave );
 						doc.on( 'mouseup',
-							function()
+							function( evt )
 							{
+								// IE context-menu event in table cells collapse
+								// whatever selection is, avoiding saving this
+								// 'wrong' snapshot.(#3001)
+								var evt = evt.data;
+								if ( evt.$.button == 2
+										&& evt.getTarget().hasAscendant( 'table' ) )
+									return;
+
 								saveEnabled = true;
 								setTimeout( function()
@@ -641,6 +649,8 @@
 								var startContainer = range.startContainer,
 									startOffset = range.startOffset;
+								// Limit the fix only to non-block elements.(#3950)
 								if ( startOffset == ( startContainer.getChildCount ?
-									startContainer.getChildCount() : startContainer.getLength() ) )
+									 startContainer.getChildCount() : startContainer.getLength() )
+									 && !startContainer.isBlockBoundary() )
 									range.setStartAfter( startContainer );
 								else break;
@@ -943,4 +953,8 @@
 	};
 })();
+( function()
+{
+var notWhitespaces = CKEDITOR.dom.walker.whitespaces( true );
+var fillerTextRegex = /\ufeff|\u00a0/;
 
 CKEDITOR.dom.range.prototype.select =
@@ -987,5 +1001,7 @@
 				// Actually, we are using this flag just to avoid using this hack in all
 				// situations, but just on those needed.
-				isStartMarkerAlone = forceExpand || !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) );
+				var next = startNode.getNext( notWhitespaces );
+				isStartMarkerAlone = ( !( next && next.getText && next.getText().match( fillerTextRegex ) )     // already a filler there?
+									  && ( forceExpand || !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) ) );
 
 				// Append a temporary <span>&#65279;</span> before the selection.
@@ -1071,2 +1087,3 @@
 			selection.addRange( nativeRange );
 		};
+} )();
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/templates/dialogs/templates.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/templates/dialogs/templates.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/templates/dialogs/templates.js	(revision 4555)
@@ -82,4 +82,15 @@
 		if( isInsert )
 		{
+			// Everything should happen after the document is loaded (#4073).
+			editor.on( 'contentDom', function( evt )
+			{
+				evt.removeListener();
+				dialog.hide();
+
+				// Place the cursor at the first editable place.
+				var range = new CKEDITOR.dom.range( editor.document );
+				range.moveToElementEditStart( editor.document.getBody() );
+				range.select( true );
+			} );
 			editor.setData( html );
 		}
@@ -87,7 +98,6 @@
 		{
 			editor.insertHtml( html );
+			dialog.hide();
 		}
-
-		dialog.hide();
 	}
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4555)
@@ -330,14 +330,9 @@
 					};
 
-					// The script that is appended to the data being loaded. It
-					// enables editing, and makes some
+					// The script that launches the bootstrap logic on 'domReady', so the document
+					// is fully editable even before the editing iframe is fully loaded (#4455).
 					var activationScript =
 						'<script id="cke_actscrpt" type="text/javascript">' +
-							'window.onload = function()' +
-							'{' +
-								// Call the temporary function for the editing
-								// boostrap.
-								'window.parent.CKEDITOR._["contentDomReady' + editor.name + '"]( window );' +
-							'}' +
+							'window.parent.CKEDITOR._["contentDomReady' + editor.name + '"]( window );' +
 						'</script>';
 
@@ -480,5 +475,5 @@
 						// Adds the document body as a context menu target.
 						if ( editor.contextMenu )
-							editor.contextMenu.addTarget( domDocument );
+							editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );
 
 						setTimeout( function()
@@ -641,4 +636,40 @@
 		}
 	});
+
+	// Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)
+	if( CKEDITOR.env.gecko )
+	{
+		var topWin = window.top;
+
+		( function ()
+		{
+			var topBody = topWin.document.body;
+
+			if( !topBody )
+				topWin.addEventListener( 'load', arguments.callee, false );
+			else
+			{
+				topBody.setAttribute( 'onpageshow', topBody.getAttribute( 'onpageshow' )
+						+ ';event.persisted && CKEDITOR.tools.callFunction(' +
+						CKEDITOR.tools.addFunction( function()
+						{
+							var allInstances = CKEDITOR.instances,
+								editor,
+								doc;
+							for( var i in allInstances )
+							{
+								editor = allInstances[ i ];
+								doc = editor.document;
+								if( doc )
+								{
+									doc.$.designMode = 'off';
+									doc.$.designMode = 'on';
+								}
+							}
+						} ) + ')' );
+			}
+		} )();
+
+	}
 })();
 
Index: /CKEditor/branches/versions/3.1.x/_source/skins/kama/editor.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/kama/editor.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/kama/editor.css	(revision 4555)
@@ -15,7 +15,11 @@
 
 /* Restore the container visibility */
-html .cke_skin_kama,
-html.cke_skin_kama_container
+html .cke_skin_kama
 {
 	visibility: inherit;
 }
+
+html.cke_skin_kama_container
+{
+	visibility: visible;
+}
Index: /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js	(revision 4555)
@@ -6,5 +6,6 @@
 CKEDITOR.skins.add( 'kama', (function()
 {
-	var preload = [];
+	var preload = [],
+		uiColorStylesheetId = 'cke_ui_color';
 
 	if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
@@ -90,10 +91,13 @@
 			}
 
-			function addStylesheet( document )
-			{
-				var node = document.getHead().append( 'style' );
-				node.setAttribute( "id", "cke_ui_color" );
-				node.setAttribute( "type", "text/css" );
-
+			function getStylesheet( document )
+			{
+				var node = document.getById( uiColorStylesheetId );
+				if( !node )
+				{
+					node = document.getHead().append( 'style' );
+					node.setAttribute( "id", uiColorStylesheetId );
+					node.setAttribute( "type", "text/css" );
+				}
 				return node;
 			}
@@ -106,8 +110,4 @@
 					if ( CKEDITOR.env.webkit )
 					{
-						// Truncate manually.
-						for ( i = 0 ; i < styleNodes[ id ].$.sheet.rules.length ; i++ )
-							styleNodes[ id ].$.sheet.removeRule( i );
-
 						for ( i = 0 ; i < styleContent.length ; i++ )
 						{
@@ -126,7 +126,7 @@
 
 						if ( CKEDITOR.env.ie )
-							styleNodes[ id ].$.styleSheet.cssText = content;
+							styleNodes[ id ].$.styleSheet.cssText += content;
 						else
-							styleNodes[ id ].setHtml( content );
+							styleNodes[ id ].$.innerHTML += content;
 					}
 				}
@@ -147,5 +147,5 @@
 				{
 					var cssContent,
-						uiStyle = addStylesheet( CKEDITOR.document ),
+						uiStyle = getStylesheet( CKEDITOR.document ),
 						cssId = '#cke_' + CKEDITOR.tools.escapeCssSelector( editor.name );
 
@@ -187,5 +187,5 @@
 				if ( !iframe.getById( 'cke_ui_color' ) )
 				{
-					var node = addStylesheet( iframe );
+					var node = getStylesheet( iframe );
 					uiColorMenus.push( node );
 
Index: /CKEditor/branches/versions/3.1.x/_source/skins/kama/toolbar.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/kama/toolbar.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/kama/toolbar.css	(revision 4555)
@@ -389,2 +389,9 @@
 }
 /* END IE8 strict button valign correction */
+
+/* Fix cursor shape consistency on toolbar combos (#4031) */
+.cke_skin_kama .cke_browser_ie .cke_rcombo,
+.cke_skin_kama .cke_browser_ie .cke_rcombo *
+{
+	cursor: default;
+}
Index: /CKEditor/branches/versions/3.1.x/_source/skins/office2003/editor.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/office2003/editor.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/office2003/editor.css	(revision 4555)
@@ -15,7 +15,11 @@
 
 /* Restore the container visibility */
-html .cke_skin_office2003,
-html.cke_skin_office2003_container
+html .cke_skin_office2003
 {
 	visibility: inherit;
 }
+
+html.cke_skin_office2003_container
+{
+	visibility: visible;
+}
Index: /CKEditor/branches/versions/3.1.x/_source/skins/office2003/toolbar.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/office2003/toolbar.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/office2003/toolbar.css	(revision 4555)
@@ -447,2 +447,9 @@
 	vertical-align: baseline;
 }
+
+/* Fix cursor shape consistency on toolbar combos (#4031) */
+.cke_skin_office2003 .cke_browser_ie .cke_rcombo,
+.cke_skin_office2003 .cke_browser_ie .cke_rcombo *
+{
+	cursor: default;
+}
Index: /CKEditor/branches/versions/3.1.x/_source/skins/v2/editor.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/v2/editor.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/v2/editor.css	(revision 4555)
@@ -15,7 +15,11 @@
 
 /* Restore the container visibility */
-html .cke_skin_v2,
-html.cke_skin_v2_container
+html .cke_skin_v2
 {
 	visibility: inherit;
 }
+
+html.cke_skin_v2_container
+{
+	visibility: visible;
+}
Index: /CKEditor/branches/versions/3.1.x/_source/skins/v2/toolbar.css
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/v2/toolbar.css	(revision 4554)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/v2/toolbar.css	(revision 4555)
@@ -404,2 +404,9 @@
 	vertical-align: baseline;
 }
+
+/* Fix cursor shape consistency on toolbar combos (#4031) */
+.cke_skin_v2 .cke_browser_ie .cke_rcombo,
+.cke_skin_v2 .cke_browser_ie .cke_rcombo *
+{
+	cursor: default;
+}
