Also copy cloneable objects in ve.copyArray()

Change-Id: I572afc282557bab059df0b2a4fd0347336531409
This commit is contained in:
Catrope 2012-08-30 12:27:40 -07:00
parent f26ae1662b
commit 3ece6e825d

View file

@ -307,7 +307,7 @@ ve.compareArrays = function ( a, b, objectsByValue ) {
};
/**
* Gets a deep copy of an array's string, number, array and plain-object contents.
* Gets a deep copy of an array's string, number, array, plain-object and cloneable object contents.
*
* @static
* @method
@ -326,6 +326,8 @@ ve.copyArray = function ( source ) {
destination.push( ve.copyObject( sourceValue ) );
} else if ( ve.isArray( sourceValue ) ) {
destination.push( ve.copyArray( sourceValue ) );
} else if ( typeof sourceValue.clone === 'function' ) {
destination.push( sourceValue.clone() );
}
}
return destination;