Opened 17 years ago

Closed 17 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:


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 ] ;
		// 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 17 years ago by Alfonso Martínez de Lizarrondo

Milestone: FCKeditor 2.5
Resolution: fixed
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy