From 623bbb49afcf438fcba59d1c7db6ab8c537c961e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Josep=20Llodra=CC=80?= Date: Fri, 24 Feb 2012 13:01:11 +0100 Subject: [PATCH] Prevent crashing when using unsupported css3 properties for your browser in labelsDivStyles --- dygraph.js | 8 +++++--- tests/customLabelCss3.html | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 tests/customLabelCss3.html diff --git a/dygraph.js b/dygraph.js index 0748d26..fed1cf4 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1002,9 +1002,11 @@ Dygraph.prototype.createStatusMessage_ = function() { var div = document.createElement("div"); div.className = "dygraph-legend"; for (var name in messagestyle) { - if (messagestyle.hasOwnProperty(name)) { - div.style[name] = messagestyle[name]; - } + try { + div.style[name] = messagestyle[name]; + } catch (e) { + console.warn("You are using unsupported css properties for your browser in labelsDivStyles"); + } } this.graphDiv.appendChild(div); this.attrs_.labelsDiv = div; diff --git a/tests/customLabelCss3.html b/tests/customLabelCss3.html new file mode 100644 index 0000000..c90af5f --- /dev/null +++ b/tests/customLabelCss3.html @@ -0,0 +1,41 @@ + + + + + Label styles + + + + + + + +

Labels are styled with css3:

+
+ + + + -- 2.7.4