Fixed keywords interactions when cloning a slide.

Fixed object cloning function to support arrays.
namespaces
Frode Petterson 2013-04-18 09:51:58 +02:00
parent b47f1bbcd8
commit 9dcb4c5951
1 changed files with 5 additions and 5 deletions

View File

@ -275,13 +275,13 @@ H5P.playVideo = function ($target, params, skipButtonText, cp, onEnded) {
* @param {type} recursive
* @returns {object} A clone of object.
*/
H5P.cloneObject = function (object, recursive) {
var clone = {};
H5P.cloneObject = function (object, recursive, array) {
var clone = array !== undefined && array ? [] : {};
for (var i in object) {
if (object.hasOwnProperty(i)) {
if (recursive !== undefined && recursive && typeof object[i] === 'object') {
clone[i] = object[i] instanceof Array ? object[i].slice() : H5P.cloneObject(object[i], recursive);
clone[i] = H5P.cloneObject(object[i], recursive, object[i] instanceof Array);
}
else {
clone[i] = object[i];