Ticket #2085 (closed Bug: invalid)
Error in JS with unknown function at time of unload.
| Reported by: | Fil | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Project : MediaWiki+FCKeditor | Version: | SVN |
| Keywords: | Pending WorksForMe | Cc: |
Description
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@…
Change History
Note: See
TracTickets for help on using
tickets.