Index: _source/plugins/htmldataprocessor/plugin.js
===================================================================
--- _source/plugins/htmldataprocessor/plugin.js	(revision 6348)
+++ _source/plugins/htmldataprocessor/plugin.js	(revision )
@@ -80,6 +80,10 @@
 
 	var dtd = CKEDITOR.dtd;
 
+	// Define orders of table elements.
+	var tableOrder = [ 'caption', 'colgroup', 'col', 'thead', 'tbody', 'tfoot' ];
+
+
 	// Find out the list of block-like tags that can contain <br>.
 	var blockLikeTags = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent );
 	for ( var i in blockLikeTags )
@@ -160,6 +164,17 @@
 					return element;
 				},
 
+				// The contents of table should be in correct order (#4809).
+				table : function( element )
+				{
+					var children = element.children;
+					children.sort( function ( node1, node2 )
+								   {
+									   return node1.type == CKEDITOR.NODE_ELEMENT && node2.type == node1.type ?
+											tableOrder.indexOf( node1.name ) > tableOrder.indexOf( node2.name ) ? 1 : -1 : 0;
+								   } );
+				},
+
 				embed : function( element )
 				{
 					var parent = element.parent;
