From 0bcd43f35e71d8eb98e6c629340287c4af345811 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 14 Jun 2017 14:46:29 +0800 Subject: [PATCH] add --- bi/core.js | 4 ++-- docs/core.js | 4 ++-- src/core/func/function.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bi/core.js b/bi/core.js index 8cb222b3d..74a546c95 100644 --- a/bi/core.js +++ b/bi/core.js @@ -16822,7 +16822,7 @@ BI.extend(BI.DOM, { }, isColor: function (color) { - return this.isRGBColor(color) || this.isHexColor(color); + return color && (this.isRGBColor(color) || this.isHexColor(color)); }, isRGBColor: function (color) { @@ -16853,7 +16853,7 @@ BI.extend(BI.DOM, { //获取对比颜色 getContrastColor: function (color) { - if (!color) { + if (!color || !this.isColor(color)) { return ""; } if (this.isDarkColor(color)) { diff --git a/docs/core.js b/docs/core.js index 0c3403acc..43424df7d 100644 --- a/docs/core.js +++ b/docs/core.js @@ -22840,7 +22840,7 @@ BI.extend(BI.DOM, { }, isColor: function (color) { - return this.isRGBColor(color) || this.isHexColor(color); + return color && (this.isRGBColor(color) || this.isHexColor(color)); }, isRGBColor: function (color) { @@ -22871,7 +22871,7 @@ BI.extend(BI.DOM, { //获取对比颜色 getContrastColor: function (color) { - if (!color) { + if (!color || !this.isColor(color)) { return ""; } if (this.isDarkColor(color)) { diff --git a/src/core/func/function.js b/src/core/func/function.js index b26cb99df..5cb7acfab 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -104,7 +104,7 @@ BI.extend(BI.DOM, { }, isColor: function (color) { - return this.isRGBColor(color) || this.isHexColor(color); + return color && (this.isRGBColor(color) || this.isHexColor(color)); }, isRGBColor: function (color) { @@ -135,7 +135,7 @@ BI.extend(BI.DOM, { //获取对比颜色 getContrastColor: function (color) { - if (!color) { + if (!color || !this.isColor(color)) { return ""; } if (this.isDarkColor(color)) {