Index: /CKEditor/trunk/_source/adapters/jquery.js
===================================================================
--- /CKEditor/trunk/_source/adapters/jquery.js	(revision 4777)
+++ /CKEditor/trunk/_source/adapters/jquery.js	(revision 4778)
@@ -49,4 +49,6 @@
 		? true : CKEDITOR.config.jqueryOverrideVal;
 
+	var jQuery = window.jQuery;
+
 	if ( typeof jQuery == 'undefined' )
 		return;
@@ -143,5 +145,8 @@
 							// Delay bit more if editor is still not ready.
 							if ( !editor.element )
-								return setTimeout( arguments.callee, 100 );
+							{
+								setTimeout( arguments.callee, 100 );
+								return;
+							}
 
 							// Remove this listener.
@@ -214,5 +219,8 @@
 							// Delay bit more if editor is still not ready.
 							if ( !editor.element )
-								return setTimeout( arguments.callee, 100 );
+							{
+								setTimeout( arguments.callee, 100 );
+								return;
+							}
 
 							if ( editor.element.$ == element )
@@ -276,4 +284,6 @@
 						}
 					}
+					
+					return true;
 				});
 				return isSetter ? this : result;
Index: /CKEditor/trunk/_source/core/dtd.js
===================================================================
--- /CKEditor/trunk/_source/core/dtd.js	(revision 4777)
+++ /CKEditor/trunk/_source/core/dtd.js	(revision 4778)
@@ -1,3 +1,3 @@
-﻿﻿/*
+﻿/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
Index: /CKEditor/trunk/_source/core/htmlparser/element.js
===================================================================
--- /CKEditor/trunk/_source/core/htmlparser/element.js	(revision 4777)
+++ /CKEditor/trunk/_source/core/htmlparser/element.js	(revision 4778)
@@ -213,5 +213,6 @@
 
 			// Send the attributes.
-			for ( i = 0, len = attribsArray.length ; i < len ; i++ )
+			var len = attribsArray.length;
+			for ( i = 0 ; i < len ; i++ )
 			{
 				var attrib = attribsArray[ i ];
Index: /CKEditor/trunk/_source/plugins/clipboard/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/clipboard/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/clipboard/plugin.js	(revision 4778)
@@ -235,5 +235,5 @@
 			callback( pastebin[ 'get' + ( mode == 'text' ? 'Value' : 'Html' ) ]() );
 		}, 0 );
-	};
+	}
 
 	// Register the plugin.
Index: /CKEditor/trunk/_source/plugins/div/dialogs/div.js
===================================================================
--- /CKEditor/trunk/_source/plugins/div/dialogs/div.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/div/dialogs/div.js	(revision 4778)
@@ -32,5 +32,5 @@
 			var child = children.getItem( i );
 			if( ! ( child.type === CKEDITOR.NODE_TEXT 
-				&& /^[ \t\n\r]+$/.test( child.getText() ) ) )
+				&& ( /^[ \t\n\r]+$/ ).test( child.getText() ) ) )
 				retval.push( child );
 		}
@@ -115,5 +115,6 @@
 							// ignore default element attribute values
 							if ( 'dir' == field.id && element.getComputedStyle( 'direction' ) == fieldValue )
-								return true;
+								return;
+
 							if ( fieldValue )
 								element.setAttribute( field.id, fieldValue );
@@ -182,5 +183,5 @@
 				// Calculate the common parent node of all contained elements.
 				ancestor = currentNode.getParent();
-				for ( var j = 1 ; j < blockGroups[ i ].length; j++ )
+				for ( j = 1 ; j < blockGroups[ i ].length; j++ )
 					ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] );
 
@@ -188,5 +189,5 @@
 				
 				// Normalize the blocks in each group to a common parent.
-				for( var j = 0; j < blockGroups[ i ].length ; j++ )
+				for( j = 0; j < blockGroups[ i ].length ; j++ )
 				{
 					currentNode = blockGroups[ i ][ j ];
@@ -201,5 +202,5 @@
 				// Wrapped blocks counting
 				var fixedBlock = null;
-				for ( var j = 0 ; j < blockGroups[ i ].length ; j++ )
+				for ( j = 0 ; j < blockGroups[ i ].length ; j++ )
 				{
 					currentNode = blockGroups[ i ][ j ];
@@ -211,5 +212,5 @@
 
 						// Establish new container, wrapping all elements in this group.
-						if ( j == 0 )
+						if ( !j )
 							divElement.insertBefore( currentNode );
 
Index: /CKEditor/trunk/_source/plugins/div/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/div/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/div/plugin.js	(revision 4778)
@@ -58,5 +58,5 @@
 						}
 
-						for ( var i = 0 ; i < toRemove.length ; i++ )
+						for ( i = 0 ; i < toRemove.length ; i++ )
 							toRemove[ i ].remove( true );
 
@@ -107,5 +107,5 @@
 									editdiv : CKEDITOR.TRISTATE_OFF,
 									removediv : CKEDITOR.TRISTATE_OFF
-								}
+								};
 							}
 
Index: /CKEditor/trunk/_source/plugins/fakeobjects/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/fakeobjects/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/fakeobjects/plugin.js	(revision 4778)
@@ -86,5 +86,5 @@
 {
 	var lang = this.lang.fakeobjects, 
-		html, writer;
+		html;
 
 	var writer = new CKEDITOR.htmlParser.basicWriter();
Index: /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 4778)
@@ -290,5 +290,5 @@
 	function unprotectRealComments( html )
 	{
-		return html.replace( /<!--{cke_protected}{C}([\s\S]+?)-->/g, function( match, data )
+		return html.replace( /<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g, function( match, data )
 			{
 				return decodeURIComponent( data );
@@ -305,5 +305,5 @@
 				// Script tags will also be forced to be protected, otherwise
 				// IE will execute them.
-				/<script[\s\S]*?<\/script>/gi,
+				( /<script[\s\S]*?<\/script>/gi ),
 
 				// <noscript> tags (get lost in IE and messed up in FF).
Index: /CKEditor/trunk/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 4778)
@@ -91,5 +91,5 @@
 			retval = {};
 		
-		if ( anchorMatch = href.match( anchorRegex ) )
+		if ( ( anchorMatch = href.match( anchorRegex ) ) )
 		{
 			retval.type = 'anchor';
@@ -1357,5 +1357,5 @@
 		}
 	};
-} )
+});
 
 /**
Index: /CKEditor/trunk/_source/plugins/pagebreak/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pagebreak/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/pagebreak/plugin.js	(revision 4778)
@@ -56,5 +56,5 @@
 						div : function( element )
 						{
-							var attributes = element.attributes
+							var attributes = element.attributes,
 								style = attributes && attributes.style,
 								child = style && element.children.length == 1 && element.children[ 0 ],
Index: /CKEditor/trunk/_source/plugins/pastefromword/filter/default.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastefromword/filter/default.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/pastefromword/filter/default.js	(revision 4778)
@@ -50,4 +50,5 @@
 	{
 		var child;
+
 		for ( var i = 0 ; i < this.children.length ; i++ )
 		{
@@ -58,5 +59,5 @@
 			{
 				child = child.firstChild( evaluator );
-				if( child )
+				if ( child )
 					return child;
 				else
@@ -64,4 +65,6 @@
 			}
 		}
+
+		return null;
 	};
 
@@ -80,5 +83,5 @@
 				for( var style in name )
 				{
-					if( name.hasOwnProperty( style) )
+					if( name.hasOwnProperty( style ) )
 						addingStyleText += style + ':' + name[ style ] + ';';
 				}
@@ -192,5 +195,5 @@
 				var text;
 				return ( ( text = element.onlyChild() )
-					    && /^(:?\s|&nbsp;)+$/.test( text.value ) );
+					    && ( /^(:?\s|&nbsp;)+$/ ).test( text.value ) );
 			},
 
@@ -216,5 +219,5 @@
 								[ 'line-height' ],
 								// Resolve indent level from 'margin-left' value.
-								[ /^margin(:?-left)?$/, null, function( value )
+								[ ( /^margin(:?-left)?$/ ), null, function( value )
 								{
 									// Be able to deal with component/short-hand form style.
@@ -223,5 +226,5 @@
 									attrs[ 'cke:indent' ] =
 										// Indent margin unit by 36pt.
-										Math.floor( parseInt( value ) / 36 );
+										Math.floor( parseInt( value, 10 ) / 36 );
 								} ]
 							] )( attrs.style, element ) || '' ;
@@ -357,5 +360,5 @@
 							listType = listItem.attributes[ 'cke:listtype' ];
 							// The indent attribute might not present.
-							listItemIndent = parseInt( listItemAttrs[ 'cke:indent' ] ) || 0;
+							listItemIndent = parseInt( listItemAttrs[ 'cke:indent' ], 10 ) || 0;
 
 							// Ignore the 'list-style-type' attribute if it's matched with
@@ -481,13 +484,13 @@
 				{
 					return function( element )
-					{
-						var styleDef =
-								variables ?
-									new CKEDITOR.style( styleDefiniton, variables )._.definition
-									: styleDefiniton;
-						element.name = styleDef.element;
-						CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) );
-						element.addStyle( CKEDITOR.style.getStyleText( styleDef ) );
-					}
+						{
+							var styleDef =
+									variables ?
+										new CKEDITOR.style( styleDefiniton, variables )._.definition
+										: styleDefiniton;
+							element.name = styleDef.element;
+							CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) );
+							element.addStyle( CKEDITOR.style.getStyleText( styleDef ) );
+						};
 				},
 
@@ -561,5 +564,5 @@
 				[
 					// Remove script, meta and link elements.
-					[ /meta|link|script/, '' ]
+					[ ( /meta|link|script/ ), '' ]
 				],
 
@@ -591,5 +594,5 @@
 						{
 							attrs.style = stylesFilter(
-										[ [ /^width|height$/, null, convertToPx ] ] )( attrs.style ) || '';
+										[ [ ( /^width|height$/ ), null, convertToPx ] ] )( attrs.style ) || '';
 						}
 
@@ -806,5 +809,5 @@
 						{
 							delete element.name;
-							return;
+							return null;
 						}
 
@@ -837,11 +840,12 @@
 										// Drop 'inline-height' style which make lines overlapping.
 										[ 'line-height' ],
-										[ /^font-family$/, null, !removeFontStyles ? styleMigrateFilter( config[ 'font_style' ], 'family' ) : null ] ,
-										[ /^font-size$/, null, !removeFontStyles ? styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) : null ] ,
-										[ /^color$/, null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_foreStyle' ], 'color' ) : null ] ,
-										[ /^background-color$/, null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) : null ]
+										[ ( /^font-family$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'font_style' ], 'family' ) : null ] ,
+										[ ( /^font-size$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) : null ] ,
+										[ ( /^color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_foreStyle' ], 'color' ) : null ] ,
+										[ ( /^background-color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) : null ]
 									] )( styleText, element ) || '';
 						}
 
+						return null;
 					},
 
@@ -871,11 +875,11 @@
 				[
 					// Remove onmouseover and onmouseout events (from MS Word comments effect)
-					[ /^onmouse(:?out|over)/, '' ],
+					[ ( /^onmouse(:?out|over)/ ), '' ],
 					// Onload on image element.
-					[ /^onload$/, '' ],
+					[ ( /^onload$/ ), '' ],
 					// Remove office and vml attribute from elements.
-					[ /(?:v|o):\w+/, '' ],
+					[ ( /(?:v|o):\w+/ ), '' ],
 					// Remove lang/language attributes.
-					[ /^lang/, '' ]
+					[ ( /^lang/ ), '' ]
 				],
 
@@ -887,5 +891,5 @@
 					// be the ones that could later be altered with editor tools.
 					[
-						[ /^margin$|^margin-(?!bottom|top)/, null, function( value, element )
+						[ ( /^margin$|^margin-(?!bottom|top)/ ), null, function( value, element )
 							{
 								if( element.name in { p : 1, div : 1 }
@@ -894,5 +898,5 @@
 							} ],
 
-						[ /^border.*|margin.*|vertical-align|float$/ , null,
+						[ ( /^border.*|margin.*|vertical-align|float$/ ), null,
 							function( value, element )
 							{
@@ -901,5 +905,5 @@
 							} ],
 
-						[ /^width|height$/, null,
+						[ (/^width|height$/ ), null,
 							function( value, element )
 							{
@@ -910,7 +914,7 @@
 					// Otherwise provide a black-list of styles that we remove.
 					[
-						[ /^mso-/ ],
+						[ ( /^mso-/ ) ],
 						// Fixing color values.
-						[ /-color$/, null, function( value )
+						[ ( /-color$/ ), null, function( value )
 						{
 							if( value == 'transparent' )
@@ -920,10 +924,10 @@
 						} ],
 						// Remove empty margin values, e.g. 0.00001pt 0em 0pt
-						[ /^margin$/, emptyMarginRegex ],
+						[ ( /^margin$/ ), emptyMarginRegex ],
 						[ 'text-indent', '0cm' ],
 						[ 'page-break-before' ],
 						[ 'tab-stops' ],
 						[ 'display', 'none' ],
-						removeFontStyles ? [ /font-?/ ] : null,
+						removeFontStyles ? [ ( /font-?/ ) ] : null
 					], removeStyles ),
 
Index: /CKEditor/trunk/_source/plugins/pastefromword/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastefromword/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/pastefromword/plugin.js	(revision 4778)
@@ -53,5 +53,5 @@
 				// MS-WORD format sniffing.
 				if ( ( mswordHtml = data[ 'html' ] )
-					 && ( forceFromWord || /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test( mswordHtml ) ) )
+					 && ( forceFromWord || ( /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/ ).test( mswordHtml ) ) )
 				{
 					var isLazyLoad = this.loadFilterRules( function()
Index: /CKEditor/trunk/_source/plugins/pastetext/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastetext/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/pastetext/plugin.js	(revision 4778)
@@ -25,10 +25,10 @@
 				function()
 				{
-					netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" );
+					window.netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" );
 
-					var clip = Components.classes[ "@mozilla.org/widget/clipboard;1" ]
-							.getService( Components.interfaces.nsIClipboard );
-					var trans = Components.classes[ "@mozilla.org/widget/transferable;1" ]
-							.createInstance( Components.interfaces.nsITransferable );
+					var clip = window.Components.classes[ "@mozilla.org/widget/clipboard;1" ]
+							.getService( window.Components.interfaces.nsIClipboard );
+					var trans = window.Components.classes[ "@mozilla.org/widget/transferable;1" ]
+							.createInstance( window.Components.interfaces.nsITransferable );
 					trans.addDataFlavor( "text/unicode" );
 					clip.getData( trans, clip.kGlobalClipboard );
@@ -36,5 +36,5 @@
 					var str = {}, strLength = {}, clipboardText;
 					trans.getTransferData( "text/unicode", str, strLength );
-					str = str.value.QueryInterface( Components.interfaces.nsISupportsString );
+					str = str.value.QueryInterface( window.Components.interfaces.nsISupportsString );
 					clipboardText = str.data.substring( 0, strLength.value / 2 );
 					return clipboardText;
@@ -50,4 +50,6 @@
 			else
 				editor.fire( 'paste', { 'text' : clipboardText } );
+			
+			return true;
 		}
 	};
@@ -99,18 +101,4 @@
 		requires : [ 'clipboard' ]
 	});
-
-	function doInsertText( doc, text )
-	{
-		// Native text insertion.
-		if( CKEDITOR.env.ie )
-		{
-			var selection = doc.selection;
-			if ( selection.type == 'Control' )
-				selection.clear();
-			selection.createRange().pasteHTML( text );
-		}
-		else
-			doc.execCommand( 'inserthtml', false, text );
-	}
 
 	function doEnter( editor, mode, times, forceMode )
Index: /CKEditor/trunk/_source/plugins/showborders/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/showborders/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/showborders/plugin.js	(revision 4778)
@@ -66,5 +66,5 @@
 			command.canUndo = false;
 
-			if ( editor.config.startupShowBorders != false )
+			if ( editor.config.startupShowBorders !== false )
 				command.setState( CKEDITOR.TRISTATE_ON );
 
@@ -102,5 +102,5 @@
 								var attributes = element.attributes,
 									cssClass = attributes[ 'class' ],
-									border = parseInt( attributes.border );
+									border = parseInt( attributes.border, 10 );
 
 								if ( !border || border <= 0 )
@@ -149,9 +149,9 @@
 						{
 							return function( data, selectedTable )
-							{
-								org.apply( this, arguments );
-								var value = parseInt( this.getValue() );
-								selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName );
-							}
+								{
+									org.apply( this, arguments );
+									var value = parseInt( this.getValue(), 10 );
+									selectedTable[ ( !value || value <= 0 ) ? 'addClass' : 'removeClass' ]( showBorderClassName );
+								};
 						} );
 					}
Index: /CKEditor/trunk/_source/plugins/tabletools/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/tabletools/plugin.js	(revision 4777)
+++ /CKEditor/trunk/_source/plugins/tabletools/plugin.js	(revision 4778)
@@ -482,5 +482,5 @@
 				count = trs.count();
 
-			for ( var i = count - 1; i >= 0; i-- )
+			for ( i = count - 1; i >= 0; i-- )
 			{
 				var tailTr = trs.getItem( i );
@@ -554,7 +554,9 @@
 		{
 			newCellRowSpan = newRowSpan = 1;
-			var newCellTr = tr.clone();
+
+			newCellTr = tr.clone();
 			newCellTr.insertAfter( tr );
 			newCellTr.append( newCell = cell.clone() );
+
 			var cellsInSameRow = cellInRow( map, rowIndex );
 			for ( var i = 0; i < cellsInSameRow.length; i++ )
