#2927: CKEDITOR.event duplicate dom event registration
-------------------------------+--------------------------------------------
 Reporter:  garry.yao          |       Owner:  garry.yao   
     Type:  Bug                |      Status:  assigned    
 Priority:  High               |   Milestone:  CKEditor 3.0
Component:  General            |     Version:  SVN         
 Keywords:  Confirmed Review?  |  
-------------------------------+--------------------------------------------

Comment(by martinkou):

 Very good observation.

 There's still one problem with the patch though. Most of the code
 _source/core/event.js assumes the existence of this._.events. Now that we
 know putting the _.events objects via prototypes is wrong, so we aren't
 putting the object into the prototype. A side effect to the fix, however,
 is that it is now possible for objects extended by
 CKEDITOR.event.implementOn(prototype, true) to have no _.events at all -
 which is also wrong.

 To demonstrate that, a simple JavaScript snippet for Firebug will show:
 {{{
 function con()
 {
  this._ = {};
 }
 con.prototype = { sayhi: function(){ alert('hi'); } };

 CKEDITOR.event.implementOn(con.prototype, true);

 var obj = new con();
 obj.fire( 'e' );
 }}}

 The last line will raise a JavaScript error, because
 CKEDITOR.event::fire() assumes the existence of this._.events.

 So I'd recommend you add a little override function for all those event
 functions who depend on the existence of this._.events. So for the first
 time they're run for an object, they should check for this._.events and
 create it if it's not there. After the first run, the override code should
 assign back the ordinary event functions to the object such that the
 override code would not be unnecessarily executed in subsequent runs.

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/2927#comment:4>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to