#2085: Error in JS with unknown function at time of unload.
-----------------+----------------------------------------------------------
 Reporter:  Fil  |        Type:  Bug                          
   Status:  new  |    Priority:  Normal                       
Milestone:       |   Component:  Project : MediaWiki+FCKeditor
  Version:       |    Keywords:                               
-----------------+----------------------------------------------------------
 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
 [EMAIL PROTECTED]

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/2085>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to