﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2085	Error in JS with unknown function at time of unload.	Phil Collins		"In FCKeditor.body.php there is a javascript condition to remove an event listener. The problem is you are removing a call to a function before the function has been declared. This causes an error in FF.

The original code:

{{{
// Remove the mwSetupToolbar onload hook to avoid a JavaScript error with FF.
if ( window.removeEventListener )
	window.removeEventListener( 'load', mwSetupToolbar, false ) ;
else if ( window.detachEvent )
	window.detachEvent( 'onload', mwSetupToolbar ) ;

mwSetupToolbar = function() { return false ; } ;
}}}

As you can see the call to define mwSetupToolbar is below the condition to remove the event listener which would call the function. At the time of checking the condition the browser knows nothing of the function. 

The amended code:

{{{
mwSetupToolbar = function() { return false ; } ;

// Remove the mwSetupToolbar onload hook to avoid a JavaScript error with FF.
if ( window.removeEventListener )
	window.removeEventListener( 'load', mwSetupToolbar, false ) ;
else if ( window.detachEvent )
	window.detachEvent( 'onload', mwSetupToolbar ) ;
}}}

The new code produces no errors and now allows the FCKeditor to be built correctly.

Kind regards and many thanks,

Phil Collins
phil@morningdata.co.uk"	Bug	closed	Normal		Project : MediaWiki+FCKeditor	SVN (FCKeditor) - Retired	invalid	Pending WorksForMe	
