From 08855cd4ff2876b6455dd948129a0c2adc91352d Mon Sep 17 00:00:00 2001 From: pah100 Date: Thu, 14 Jan 2016 16:03:54 +0800 Subject: [PATCH] enhance merge method and fix ec option.backgroundColor merge bug. --- src/core/util.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/util.js b/src/core/util.js index f3ad937c5..e1e688e48 100644 --- a/src/core/util.js +++ b/src/core/util.js @@ -53,16 +53,15 @@ define(function(require) { } /** - * @param {Object=} target - * @param {Object=} source + * @param {*} target + * @param {*} source * @param {boolean} [overwrite=false] */ function merge(target, source, overwrite) { - if (!target) { // Might be null/undefined - return; - } - if (!source) { // Might be null/undefined - return target; + // We should escapse that source is string + // and enter for ... in ... + if (!isObject(source) || !isObject(target)) { + return overwrite ? clone(source) : target; } for (var key in source) {