Ticket #4555: 4555_2.patch
File 4555_2.patch, 6.3 KB (added by , 13 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 var expandoNumber = this.$._cke_expando; 224 expandoNumber && delete customData[ expandoNumber ]; 225 }; 226 227 /** 200 228 * @name CKEDITOR.dom.domObject.prototype.getCustomData 201 229 */ 202 230 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 this.mode = ''; 477 } 478 471 479 this.theme.destroy( this ); 472 this.fire( 'destroy' ); 480 delete this.focusManager._.editor; 481 delete this.ui._.editor; 482 483 if (CKEDITOR.ui.button) 484 { 485 var globalItems = CKEDITOR.ui.button._.instances; 486 for(var index in globalItems) 487 { 488 button = globalItems[index]; 489 if (button && button.editor == this) 490 globalItems[index] = null; 491 } 492 } 493 494 var commands = this._.commands; 495 for (var command in commands) 496 { 497 var o = commands[command]; 498 o.removeAllListeners(); 499 500 for (var items in o.uiItems) 501 { 502 if (o.uiItems._) 503 delete o.uiItems._.editor 504 } 505 506 delete commands[command]; 507 } 508 509 this.fireOnce( 'destroy' ); 510 this.removeAllListeners(); 511 473 512 CKEDITOR.remove( this ); 474 513 CKEDITOR.fire( 'instanceDestroyed', null, this ); 475 514 }, -
_source/core/event.js
314 314 var index = event.getListenerIndex( listenerFunction ); 315 315 if ( index >= 0 ) 316 316 event.listeners.splice( index, 1 ); 317 // Clear the event if there are no more listeners 318 if (event.listeners.length==0) 319 delete getPrivate( this )[ eventName ] 317 320 } 318 321 }, 319 322 323 removeAllListeners : function() 324 { 325 var events = getPrivate( this ); 326 for(e in events) 327 { 328 delete events[ e ]; 329 } 330 }, 320 331 /** 321 332 * Checks if there is any listener registered to a given event. 322 333 * @param {String} eventName The event name. -
_source/plugins/button/plugin.js
92 92 93 93 var clickFn = CKEDITOR.tools.addFunction( instance.execute, instance ); 94 94 95 editor.on( 'destroy', function () { 96 CKEDITOR.tools.removeFunction( clickFn ); 97 delete instance.editor; 98 delete instance.execute; 99 delete instance.toolbar; 100 delete instance.button; 101 } ); 102 95 103 var index = CKEDITOR.ui.button._.instances.push( instance ) - 1; 96 104 97 105 var classes = ''; -
_source/plugins/toolbar/plugin.js
283 283 { 284 284 editor.execCommand( 'toolbarCollapse' ); 285 285 } ); 286 editor.on( 'destroy', function () { 287 CKEDITOR.tools.removeFunction( collapserFn ); 288 } ); 286 289 287 290 var collapserId = 'cke_' + CKEDITOR.tools.getNextNumber(); 288 291 -
_source/plugins/wysiwygarea/plugin.js
690 690 691 691 unload : function( holderElement ) 692 692 { 693 var htmlElement = editor.document.getDocumentElement() 694 htmlElement.removeAllListeners(); 695 htmlElement.clearCustomData(); 696 697 editor.window.removeAllListeners(); 698 editor.window.clearCustomData(); 699 700 editor.document.removeAllListeners(); 701 editor.document.clearCustomData(); 702 693 703 editor.window = editor.document = iframe = mainElement = isPendingFocus = null; 694 704 695 705 editor.fire( 'contentDomUnload' ); … … 758 768 editor.focus(); 759 769 } ); 760 770 } ); 771 editor.on( 'destroy', function() 772 { 773 ieFocusGrabber.removeAllListeners(); 774 ieFocusGrabber.clearCustomData(); 775 ieFocusGrabber.remove() 776 ieFocusGrabber = null; 777 } ); 761 778 } 762 779 } 763 780 }); -
_source/themes/default/theme.js
229 229 destroy : function( editor ) 230 230 { 231 231 var container = editor.container; 232 container.removeAllListeners(); 233 container.clearCustomData(); 232 234 233 235 /* 234 236 * IE BUG: Removing the editor DOM elements while the selection is inside … … 254 256 255 257 if ( container ) 256 258 container.remove(); 259 delete editor.container; 257 260 258 261 if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) 259 {260 262 editor.element.show(); 261 delete editor.element; 262 }263 264 delete editor.element; 263 265 } 264 266 }; 265 267 })() );