Ticket #5774: 5774.patch
File 5774.patch, 5.1 KB (added by , 13 years ago) |
---|
-
_source/core/dom/domobject.js
8 8 * for other classes representing DOM objects. 9 9 */ 10 10 11 /** 12 * Represents a DOM object. This class is not intended to be used directly. It 13 * serves as the base class for other classes representing specific DOM 14 * objects. 15 * @constructor 16 * @param {Object} nativeDomObject A native DOM object. 17 * @augments CKEDITOR.event 18 * @example 19 */ 20 CKEDITOR.dom.domObject = function( nativeDomObject ) 21 { 22 if ( nativeDomObject ) 23 { 24 /** 25 * The native DOM object represented by this class instance. 26 * @type Object 27 * @example 28 * var element = new CKEDITOR.dom.element( 'span' ); 29 * alert( element.$.nodeType ); // "1" 30 */ 31 this.$ = nativeDomObject; 32 } 33 }; 11 ( function() 12 { 13 // Prevent IE6 from leaking in-page elements, we have to break 14 // references to native DOM elements. 15 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) 16 { 17 var domObjects = []; 18 CKEDITOR.on( 'reset', function() 19 { 20 for ( var i = 0, length = domObjects.length; i < length; i++ ) 21 delete domObjects[ i ].$; 22 }); 23 } 24 25 /** 26 * Represents a DOM object. This class is not intended to be used directly. It 27 * serves as the base class for other classes representing specific DOM 28 * objects. 29 * @constructor 30 * @param {Object} nativeDomObject A native DOM object. 31 * @augments CKEDITOR.event 32 * @example 33 */ 34 CKEDITOR.dom.domObject = function( nativeDomObject ) 35 { 36 if ( nativeDomObject ) 37 { 38 /** 39 * The native DOM object represented by this class instance. 40 * @type Object 41 * @example 42 * var element = new CKEDITOR.dom.element( 'span' ); 43 * alert( element.$.nodeType ); // "1" 44 */ 45 this.$ = nativeDomObject; 46 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) 47 domObjects.push( this ); 48 } 49 }; 34 50 51 } )(); 52 35 53 CKEDITOR.dom.domObject.prototype = (function() 36 54 { 37 55 // Do not define other local variables here. We want to keep the native -
_source/core/ckeditor_basic.js
232 232 } 233 233 }; 234 234 235 function unload() 236 { 237 // Allow page-off cleanup to happen, 238 // mainly for protect memory leaks. 239 CKEDITOR.fire( 'reset' ); 240 241 // Detach unload function 242 if ( window.detachEvent ) 243 { 244 window.detachEvent( 'onbeforeunload', beforeUnload ); 245 window.detachEvent( 'onunload', unload ); 246 } else if ( window.removeEventListener ) 247 window.removeEventListener( 'unload', unload, false ); 248 249 // Destroy references 250 unload = null; 251 } 252 253 function beforeUnload() 254 { 255 var doc = document; 256 257 // The document may still in loading, 258 // in this case the 'unload' even won't fire at all, 259 // we have look to for the 'stop' event instead. 260 if ( doc.readyState == 'interactive' ) 261 { 262 function stop() 263 { 264 // Prevent memory leak 265 doc.detachEvent( 'onstop', stop ); 266 267 // Call unload handler 268 if ( unload ) 269 unload(); 270 271 doc = null; 272 } 273 274 // Fire unload when the currently loading page is stopped 275 if ( doc ) 276 doc.attachEvent( 'onstop', stop ); 277 278 // Remove onstop listener after a while to prevent the unload function 279 // to execute if the user presses cancel in an onbeforeunload 280 // confirm dialog and then presses the browser stop button 281 window.setTimeout( function() 282 { 283 if ( doc ) 284 doc.detachEvent( 'onstop', stop ); 285 }, 0 ); 286 } 287 } 288 235 289 if ( window.addEventListener ) 236 290 window.addEventListener( 'load', onload, false ); 237 291 else if ( window.attachEvent ) 238 292 window.attachEvent( 'onload', onload ); 293 294 if ( window.attachEvent ) 295 { 296 window.attachEvent( 'onunload', unload ); 297 window.attachEvent( 'onbeforeunload', beforeUnload ); 298 } 299 else if ( window.addEventListener ) 300 window.addEventListener( 'unload', unload, false ); 301 239 302 })(); 240 303 241 304 CKEDITOR.status = 'basic_loaded'; -
_source/core/dom/document.js
164 164 */ 165 165 getHead : function() 166 166 { 167 var head = this.$.getElementsByTagName( 'head' )[0]; 168 head = new CKEDITOR.dom.element( head ); 169 170 return ( 171 this.getHead = function() 172 { 173 return head; 174 })(); 167 return this.getElementsByTag( 'head' ).getItem( 0 ); 175 168 }, 176 169 177 170 /** … … 183 176 */ 184 177 getBody : function() 185 178 { 186 var body = new CKEDITOR.dom.element( this.$.body ); 187 188 return ( 189 this.getBody = function() 190 { 191 return body; 192 })(); 179 return new CKEDITOR.dom.element( this.$.body ); 193 180 }, 194 181 195 182 /**