From 14db35a2135643f801cb30a4c15eb1551206130f Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 17 Nov 2015 15:57:12 +0100 Subject: [PATCH] protect widgetOptions object properties --- app/browser/js/app/parser.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/browser/js/app/parser.js b/app/browser/js/app/parser.js index 0f92611d..6f4b00ef 100644 --- a/app/browser/js/app/parser.js +++ b/app/browser/js/app/parser.js @@ -79,8 +79,10 @@ parsewidgets = function(widgets,parent) { widgetData.type = widgetData.type || 'fader' - for (i in widgetOptions[widgetData.type]) { - if (widgetData[i]===undefined) widgetData[i] = widgetOptions[widgetData.type][i] + var tmpWidgetOptions = JSON.parse(JSON.stringify(widgetOptions)) + + for (i in tmpWidgetOptions[widgetData.type]) { + if (widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i] } widgetData.id = widgetData.id=='auto'?widgetData.type+'_'+getIterator(widgetData.type):widgetData.id.replace(' ','_') @@ -122,9 +124,6 @@ parsewidgets = function(widgets,parent) { // create widget var widgetInner = createWidget[widgetData.type](widgetData,widgetContainer) - widgetInner.type = widgetData.type - - widgetContainer.data(widgetData) widgetContainer.append(widgetInner)