Add clearStyleCache method

parent 8396b2bf
...@@ -52,6 +52,10 @@ c3_chart_internal_fn = c3.chart.internal.fn; ...@@ -52,6 +52,10 @@ c3_chart_internal_fn = c3.chart.internal.fn;
var nodeCss; var nodeCss;
var styleCache = {}; var styleCache = {};
c3.clearStyleCache = function(){
styleCache = {};
}
// Seek a specific value in the stylesheets of a document // Seek a specific value in the stylesheets of a document
function getStyleValue($$, selector, property) { function getStyleValue($$, selector, property) {
function cache(value){ function cache(value){
...@@ -97,6 +101,7 @@ function getStyleValue($$, selector, property) { ...@@ -97,6 +101,7 @@ function getStyleValue($$, selector, property) {
} }
for (var styleId = 0; styleId < document.styleSheets.length; styleId++) { for (var styleId = 0; styleId < document.styleSheets.length; styleId++) {
sheet = document.styleSheets[styleId]; sheet = document.styleSheets[styleId];
if(!sheet.cssRules) return undefined;
for (var ruleId = 0; ruleId < sheet.cssRules.length; ruleId++) { for (var ruleId = 0; ruleId < sheet.cssRules.length; ruleId++) {
rule = sheet.cssRules[ruleId]; rule = sheet.cssRules[ruleId];
if(rule.type !== CSSRule.STYLE_RULE) continue; if(rule.type !== CSSRule.STYLE_RULE) continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment