mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Also copy cloneable objects in ve.copyArray()
Change-Id: I572afc282557bab059df0b2a4fd0347336531409
This commit is contained in:
parent
f26ae1662b
commit
3ece6e825d
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue