Opened 18 years ago
Closed 18 years ago
#1500 closed Bug (fixed)
The _FCK_PaddingNodeListener is called multiple times
| Reported by: | Alfonso Martínez de Lizarrondo | Owned by: | Alfonso Martínez de Lizarrondo |
|---|---|---|---|
| Priority: | Normal | Milestone: | FCKeditor 2.5 |
| Component: | General | Version: | SVN (FCKeditor) - Retired |
| Keywords: | Cc: |
Description
Load the editor and press New Page several times (well, don't do it in IE or it will crash, #1498)
The OnSelectionChange event will have several calls to _FCK_PaddingNodeListener, and in Gecko also to FCK._ExecCheckEmptyBlock
I've modified slightly the FCKEvents.prototype.AttachEvent so it tries to detect if the functionPointer is already registered, but in Gecko it doesn't detect the duplication of FCK._ExecCheckEmptyBlock, so anyway the full fix (making sure that the AttachEvent is called only on startup is needed.
FCKEvents.prototype.AttachEvent = function( eventName, functionPointer )
{
var aTargets ;
if ( !( aTargets = this._RegisteredEvents[ eventName ] ) )
this._RegisteredEvents[ eventName ] = [ functionPointer ] ;
else
{
// Check that the event handler isn't already registered with the same listener
// It doesn't detect function pointers belonging to an object (at least in Gecko)
if ( aTargets.IndexOf( functionPointer ) == -1 )
aTargets.push( functionPointer ) ;
}
}
Change History (1)
comment:1 Changed 18 years ago by
| Milestone: | → FCKeditor 2.5 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |

Fixed with [1066]
The ideal solution would be to make the change to AttachEvent, so any other situation like this is automatically handled. Also it would allow to create a RemoveEvent function for the API.