Index: _whatsnew.html
===================================================================
--- _whatsnew.html	(revision 1733)
+++ _whatsnew.html	(working copy)
@@ -102,6 +102,11 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2002">#2002</a>] Fixed
 			the issue where the maximize editor button does not vertically expand the editing
 			area in Firefox.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1997">#1997</a>] With
+			IE, the first
+			character of table captions where being lost on table creation.</li>
+		<li>The selection and cursor position was not being properly handle when creating some
+			elements like forms and tables.</li>
 	</ul>
 	<h3>
 		Version 2.6 Beta 1</h3>
Index: editor/_source/classes/fckdomrange.js
===================================================================
--- editor/_source/classes/fckdomrange.js	(revision 1733)
+++ editor/_source/classes/fckdomrange.js	(working copy)
@@ -149,12 +149,20 @@
 	// is "<p><b><i>^</i></b> Text</p>" (inside <i>).
 	MoveToElementEditStart : function( targetElement )
 	{
-		var child ;
+		var editable ;
 
-		while ( ( child = targetElement.firstChild ) && child.nodeType == 1 && FCKListsLib.InlineNonEmptyElements[ child.nodeName.toLowerCase() ] )
-			targetElement = child ;
+		while ( targetElement && targetElement.nodeType == 1 )
+		{
+			if ( FCKDomTools.CheckIsEditable( targetElement ) )
+				editable = targetElement ;
+			else if ( editable )
+				break ;		// If we already found an editable element, stop the loop.
 
-		this.MoveToElementStart( targetElement ) ;
+			targetElement = targetElement.firstChild ;
+		}
+
+		if ( editable )
+			this.MoveToElementStart( editable ) ;
 	},
 
 	InsertNode : function( node )
Index: editor/_source/internals/fck.js
===================================================================
--- editor/_source/internals/fck.js	(revision 1733)
+++ editor/_source/internals/fck.js	(working copy)
@@ -669,7 +669,7 @@
 			range.SplitBlock() ;
 			range.InsertNode( element ) ;
 
-			var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ] ) ;
+			var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ], true ) ;
 
 			// Be sure that we have something after the new element, so we can move the cursor there.
 			if ( !next && FCKConfig.EnterMode != 'br')
Index: editor/_source/internals/fckdomtools.js
===================================================================
--- editor/_source/internals/fckdomtools.js	(revision 1733)
+++ editor/_source/internals/fckdomtools.js	(working copy)
@@ -1005,5 +1005,20 @@
 		var currentScroll = FCKTools.GetScrollPosition( window ).Y ;
 		if ( offset > 0 && offset > currentScroll )
 			window.scrollTo( 0, offset ) ;
+	},
+
+	/**
+	 * Check if the element can be edited inside the browser.
+	 */
+	CheckIsEditable : function( element )
+	{
+		// Get the element name.
+		var nodeName = element.nodeName.toLowerCase() ;
+
+		// Get the element DTD (defaults to span for unknown elements).
+		var childDTD = FCK.DTD[ nodeName ] || FCK.DTD.span ;
+
+		// In the DTD # == text node.
+		return ( childDTD['#'] && !FCKListsLib.NonEditableElements[ nodeName ] ) ;
 	}
 } ;
Index: editor/_source/internals/fcklistslib.js
===================================================================
--- editor/_source/internals/fcklistslib.js	(revision 1733)
+++ editor/_source/internals/fcklistslib.js	(working copy)
@@ -54,6 +54,9 @@
 	// Object elements for the Styles System.
 	StyleObjectElements : { img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 },
 
+	// Elementst that accept text nodes, but are not possible to edit in the browser.
+	NonEditableElements : { button:1,option:1,script:1,iframe:1,textarea:1,object:1,embed:1,map:1,applet:1 },
+
 	// Elements used to separate block contents.
 	BlockBoundaries : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1 },
 	ListBoundaries  : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1,br:1 }
Index: editor/dtd/fck_dtd_test.html
===================================================================
--- editor/dtd/fck_dtd_test.html	(revision 1733)
+++ editor/dtd/fck_dtd_test.html	(working copy)
@@ -17,8 +17,6 @@
 	<table border="1">
 		<script type="text/javascript">
 
-    alert(FCK.DTD);
-
 for ( var p in FCK.DTD )
 {
 	document.write( '<tr><td><b>' + p + '</b></td><td>' ) ;
Index: editor/fckdialog.html
===================================================================
--- editor/fckdialog.html	(revision 1733)
+++ editor/fckdialog.html	(working copy)
@@ -681,6 +681,7 @@
 
 	window.Cancel = function( dontFireChange )
 	{
+		Selection.EnsureSelection() ;
 		return CloseDialog( dontFireChange ) ;
 	} ;
 
@@ -688,8 +689,6 @@
 	{
 		Throbber.Hide() ;
 
-		Selection.EnsureSelection() ;
-
 		// Points the src to a non-existent location to avoid loading errors later, in case the dialog
 		// haven't been completed loaded at this point.
 		if ( $( 'frmMain' ) )
