Ticket #4555: 4555_5.patch
File 4555_5.patch, 8.4 KB (added by , 15 years ago) |
---|
-
_source/core/dom/domobject.js
115 115 delete nativeListeners[ eventName ]; 116 116 } 117 117 } 118 }, 119 120 /** @ignore */ 121 removeAllListeners : function() 122 { 123 // Call the original implementation. 124 CKEDITOR.event.prototype.removeAllListeners.apply( this ); 125 126 var nativeListeners = this.getCustomData( '_cke_nativeListeners' ); 127 for( eventName in nativeListeners) 128 { 129 var listener = nativeListeners[ eventName ]; 130 if ( this.$.removeEventListener ) 131 this.$.removeEventListener( eventName, listener, false ); 132 else if ( this.$.detachEvent ) 133 this.$.detachEvent( 'on' + eventName, listener ); 134 135 delete nativeListeners[ eventName ]; 136 } 118 137 } 119 138 }; 120 139 })(); … … 197 216 }; 198 217 199 218 /** 219 * @name CKEDITOR.dom.domObject.prototype.clearCustomData 220 */ 221 domObjectProto.clearCustomData = function() 222 { 223 // Clear all event listeners 224 this.removeAllListeners(); 225 226 var expandoNumber = this.$._cke_expando; 227 expandoNumber && delete customData[ expandoNumber ]; 228 }; 229 230 /** 200 231 * @name CKEDITOR.dom.domObject.prototype.getCustomData 201 232 */ 202 233 domObjectProto.getUniqueId = function() -
_source/core/editor.js
468 468 if ( !noUpdate ) 469 469 this.updateElement(); 470 470 471 if ( this.mode ) 472 { 473 var holderElement = this.getThemeSpace( 'contents' ), 474 currentMode = this._.modes[ editor.mode ]; 475 currentMode.unload( holderElement ); 476 } 477 471 478 this.theme.destroy( this ); 472 this.fire( 'destroy' ); 479 480 var toolbars, 481 index, j, items; 482 483 if (this.toolbox) 484 { 485 toolbars = this.toolbox.toolbars; 486 for( index = 0; index < toolbars.length ; index++ ) 487 { 488 items = toolbars[ index ].items; 489 for ( j = 0; j<items.length ; j++) 490 { 491 var instance = items[ j ]; 492 if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); 493 if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); 494 495 if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null; 496 } 497 } 498 } 499 500 if (this.contextMenu) 501 CKEDITOR.tools.removeFunction( this.contextMenu._.functionId ); 502 503 if (this._.filebrowserFn) 504 CKEDITOR.tools.removeFunction( this._.filebrowserFn ); 505 506 this.fireOnce( 'destroy' ); 507 473 508 CKEDITOR.remove( this ); 474 509 CKEDITOR.fire( 'instanceDestroyed', null, this ); 475 510 }, -
_source/core/event.js
318 318 }, 319 319 320 320 /** 321 * Removes any listener set on this object. 322 * To avoid memory leaks we must assure that there are no 323 * references left after the object is no longer needed. 324 */ 325 removeAllListeners : function() 326 { 327 var events = getPrivate( this ); 328 for(var e in events ) 329 delete events[ e ]; 330 }, 331 332 /** 321 333 * Checks if there is any listener registered to a given event. 322 334 * @param {String} eventName The event name. 323 335 * @example -
_source/core/imagecacher.js
11 11 { 12 12 var doCallback = function() 13 13 { 14 img.removeAllListeners(); 14 15 loaded[ image ] = 1; 15 16 callback(); 16 17 }; -
_source/plugins/button/plugin.js
69 69 */ 70 70 render : function( editor, output ) 71 71 { 72 var env = CKEDITOR.env; 72 var env = CKEDITOR.env, 73 id = this._.id = 'cke_' + CKEDITOR.tools.getNextNumber(), 74 classes = '', 75 command = this.command, // Get the command name. 76 clickFn, 77 index; 73 78 74 var id = this._.id = 'cke_' + CKEDITOR.tools.getNextNumber();75 79 this._.editor = editor; 76 80 77 81 var instance = … … 90 94 } 91 95 }; 92 96 93 varclickFn = CKEDITOR.tools.addFunction( instance.execute, instance );97 instance.clickFn = clickFn = CKEDITOR.tools.addFunction( instance.execute, instance ); 94 98 95 varindex = CKEDITOR.ui.button._.instances.push( instance ) - 1;99 instance.index = index = CKEDITOR.ui.button._.instances.push( instance ) - 1; 96 100 97 var classes = '';98 99 // Get the command name.100 var command = this.command;101 102 101 if ( this.modes ) 103 102 { 104 103 editor.on( 'mode', function() -
_source/plugins/resize/plugin.js
55 55 } 56 56 } ); 57 57 58 editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( mouseDownFn ) } ); 59 58 60 editor.on( 'themeSpace', function( event ) 59 61 { 60 62 if ( event.data.space == 'bottom' ) -
_source/plugins/richcombo/plugin.js
130 130 var element = CKEDITOR.document.getById( id ).getChild( 1 ); 131 131 element.focus(); 132 132 }, 133 execute: clickFn133 clickFn : clickFn 134 134 }; 135 135 136 136 editor.on( 'mode', function() … … 161 161 ev.preventDefault(); 162 162 }); 163 163 164 // For clean up 165 instance.keyDownFn = keyDownFn; 166 164 167 output.push( 165 168 '<span class="cke_rcombo">', 166 169 '<span id=', id ); -
_source/plugins/sourcearea/plugin.js
138 138 139 139 unload : function( holderElement ) 140 140 { 141 textarea.clearCustomData(); 141 142 editor.textarea = textarea = null; 142 143 143 144 if ( onResize ) -
_source/plugins/toolbar/plugin.js
284 284 editor.execCommand( 'toolbarCollapse' ); 285 285 } ); 286 286 287 editor.on( 'destroy', function () { 288 CKEDITOR.tools.removeFunction( collapserFn ); 289 } ); 290 287 291 var collapserId = 'cke_' + CKEDITOR.tools.getNextNumber(); 288 292 289 293 editor.addCommand( 'toolbarCollapse', -
_source/plugins/wysiwygarea/plugin.js
690 690 691 691 unload : function( holderElement ) 692 692 { 693 editor.document.getDocumentElement().clearCustomData(); 694 editor.document.getBody().clearCustomData(); 695 696 editor.window.clearCustomData(); 697 editor.document.clearCustomData(); 698 693 699 editor.window = editor.document = iframe = mainElement = isPendingFocus = null; 694 700 695 701 editor.fire( 'contentDomUnload' ); … … 758 764 editor.focus(); 759 765 } ); 760 766 } ); 767 editor.on( 'destroy', function() 768 { 769 ieFocusGrabber.clearCustomData(); 770 } ); 761 771 } 762 772 } 763 773 }); -
_source/themes/default/theme.js
229 229 destroy : function( editor ) 230 230 { 231 231 var container = editor.container; 232 container.clearCustomData(); 233 editor.element.clearCustomData(); 232 234 233 235 /* 234 236 * IE BUG: Removing the editor DOM elements while the selection is inside … … 256 258 container.remove(); 257 259 258 260 if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) 259 {260 261 editor.element.show(); 261 delete editor.element; 262 }262 263 delete editor.element; 263 264 } 264 265 }; 265 266 })() );