﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4640	Small optimizations in the fileBrowser plugin	Alfonso Martínez de Lizarrondo	Alfonso Martínez de Lizarrondo	"At the bottom, the elements that are reused can be declared as local variables so it's a little clearer and it will compress a little further
(sorry, I still don't have installed here any SVN to provide a diff)
{{{
	CKEDITOR.plugins.add( 'filebrowser',
	{
		init : function( editor, pluginPath )
		{
			editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor );

			CKEDITOR.on( 'dialogDefinition', function( evt )
			{
				var definition = evt.data.definition, 
					element;
				// Associate filebrowser to elements with 'filebrowser' attribute.
				for ( var i in definition.contents )
				{
					element = definition.contents[ i ] ;
					attachFileBrowser( evt.editor, evt.data.name, definition, element.elements );
					if ( element.hidden && element.filebrowser )
					{
						element.hidden =
							!isConfigured( definition, element[ 'id' ], element.filebrowser );
					}
				}
			} );
		}
	} );
}}}

In the isConfigured I think that the last line can be also optimized to avoid repeated function calls:
Turn
{{{
		return ( definition.getContents( tabId ).get( elementId ).filebrowser && 
				 definition.getContents( tabId ).get( elementId ).filebrowser.url );
}}}
Into
{{{
		var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser;
		return ( elementFileBrowser && elementFileBrowser.url );
}}}"	Bug	closed	Normal	CKEditor 3.2	General	3.0.1	fixed	Review+	
