From e0d90def936d2f1dc73de668a31b954bad0ff557 Mon Sep 17 00:00:00 2001 From: Tyler Long Date: Sun, 19 Apr 2015 15:58:09 +0800 Subject: [PATCH] IE, local html, cssRules access is denied IE, open html file directly from hard disk(insead of from a http server), cssRules access is denied. Thus an expection is thrown. But in the catch statement, another one is thrown again thus caused the whole mermaid code break. In this line `console.warn('Invalid CSS selector "' + rule.selectorText + '"', err);` rule is undefined, so exception will be thrown if we don't check. --- src/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 537af07ea..29d864a92 100644 --- a/src/utils.js +++ b/src/utils.js @@ -66,7 +66,9 @@ module.exports.cloneCssStyles = function(svg, classes){ catch(err) { if(typeof console !== 'undefined'){ if(console.warn !== 'undefined'){ - console.warn('Invalid CSS selector "' + rule.selectorText + '"', err); + if(rule !== 'undefined'){ + console.warn('Invalid CSS selector "' + rule.selectorText + '"', err); + } } } }