Ticket #3758: 3758_3.patch
File 3758_3.patch, 2.2 KB (added by , 14 years ago) |
---|
-
_source/plugins/dialog/plugin.js
98 98 // Completes the definition with the default values. 99 99 definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition ); 100 100 101 // Clone a functionally independent copy for this dialog. 102 definition = CKEDITOR.tools.clone( definition ); 103 101 104 // Create a complex definition object, extending it with the API 102 105 // functions. 103 106 definition = new definitionObject( this, definition ); -
_source/core/tools.js
38 38 39 39 /** 40 40 * Creates a deep copy of an object. 41 * Attention: there is no support for deep copy of Array properties and 42 * for recursive references. 41 * Attention: there is no support for recursive references. 43 42 * @param {Object} object The object to be cloned. 44 43 * @returns {Object} The object clone. 45 44 * @example … … 60 59 * alert( obj.cars.Porsche.color ); // red 61 60 * alert( clone.cars.Porsche.color ); // silver 62 61 */ 63 clone : function( obj ect)62 clone : function( obj ) 64 63 { 65 if( object === null || typeof( object ) != 'object') 66 return object; 64 var clone; 67 65 68 var clone = new object.constructor(); 66 // Array. 67 if ( obj && ( obj instanceof Array ) ) 68 { 69 clone = []; 70 71 for ( var i = 0 ; i < obj.length ; i++ ) 72 clone[ i ] = this.clone( obj[ i ] ); 73 74 return clone; 75 } 69 76 70 for ( var propertyName in object ) 77 // "Static" types. 78 if ( obj === null 79 || ( typeof( obj ) != 'object' ) 80 || ( obj instanceof String ) 81 || ( obj instanceof Number ) 82 || ( obj instanceof Boolean ) 83 || ( obj instanceof Date ) ) 71 84 { 72 var property = object[ propertyName ]; 85 return obj; 86 } 87 88 // Objects. 89 clone = new obj.constructor(); 90 91 for ( var propertyName in obj ) 92 { 93 var property = obj[ propertyName ]; 73 94 clone[ propertyName ] = this.clone( property ); 74 95 } 75 96