public/ckeditor/4.4dev/core/tools.js
function( obj ) {
			var clone;

			// Array.
			if ( obj && ( obj instanceof Array ) ) {
				clone = [];

				for ( var i = 0; i < obj.length; i++ )
					clone[ i ] = CKEDITOR.tools.clone( obj[ i ] );

				return clone;
			}

			// "Static" types.
			if ( obj === null || ( typeof( obj ) != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) )
				return obj;

			// DOM objects and window.
			if ( obj.nodeType || obj.window === obj )
				return obj;

			// Objects.
			clone = new obj.constructor();

			for ( var propertyName in obj ) {
				var property = obj[ propertyName ];
				clone[ propertyName ] = CKEDITOR.tools.clone( property );
			}

			return clone;
		}
function( obj ) {
			var clone;

			// Array.
			if ( obj && ( obj instanceof Array ) ) {
				clone = [];

				for ( var i = 0; i < obj.length; i++ )
					clone[ i ] = CKEDITOR.tools.clone( obj[ i ] );

				return clone;
			}

			// "Static" types.
			if ( obj === null || ( typeof( obj ) != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) )
				return obj;

			// DOM objects and window.
			if ( obj.nodeType || obj.window === obj )
				return obj;

			// Objects.
			clone = new obj.constructor();

			for ( var propertyName in obj ) {
				var property = obj[ propertyName ];
				clone[ propertyName ] = CKEDITOR.tools.clone( property );
			}

			return clone;
		}
function ( obj ) { var clone ; // Array. if ( obj && ( obj instanceof Array ) ) { clone = [ ] ; for ( var i = 0 ; i < obj . length ; i ++ ) clone [ i ] = CKEDITOR . tools . clone ( obj [ i ] ) ; return clone ; } // "Static" types. if ( obj === null || ( typeof ( obj ) != 'object' ) || ( obj instanceof String ) || ( obj instanceof Number ) || ( obj instanceof Boolean ) || ( obj instanceof Date ) || ( obj instanceof RegExp ) ) return obj ; // DOM objects and window. if ( obj . nodeType || obj . window === obj ) return obj ; // Objects. clone = new obj . constructor ( ) ; for ( var propertyName in obj ) { var property = obj [ propertyName ] ; clone [ propertyName ] = CKEDITOR . tools . clone ( property ) ; } return clone ; }
Creates a deep copy of an object.

**Note**: Recursive references are not supported.

var obj = {
name: 'John',
cars: {
Mercedes: { color: 'blue' },
Porsche: { color: 'red' }
}
};
var clone = CKEDITOR.tools.clone( obj );
clone.name = 'Paul';
clone.cars.Porsche.color = 'silver';

alert( obj.name );					// 'John'
alert( clone.name );				// 'Paul'
alert( obj.cars.Porsche.color );	// 'red'
alert( clone.cars.Porsche.color );	// 'silver'

@param {Object} object The object to be cloned.
@returns {Object} The object clone.
Creates a deep copy of an object .