Fix getStyleValue function

parent 0468c30b
......@@ -88,7 +88,7 @@ function getStyleValue($$, selector, property) {
if(isNode()){
if(!nodeCss){
var style = require('fs').readFileSync(__filename.replace('c3.js', 'c3.css'), 'utf-8');
nodeCss = [require('css').parse(style), require('css').parse($$.ed3Config.style)];
nodeCss = [require('css').parse($$.ed3Config.style), require('css').parse(style)];
}
var obj, rule, sel, decl;
......@@ -100,6 +100,7 @@ function getStyleValue($$, selector, property) {
if(!rule.selectors) continue;
for(var k = 0; k<rule.selectors.length; k++){
sel = rule.selectors[k];
if(sel !== selector) continue;
for(var l = 0; l<rule.declarations.length; l++){
decl = rule.declarations[l];
if(decl.property === property){
......@@ -135,6 +136,8 @@ function getStyleValue($$, selector, property) {
}
}
c3.getStyleValue = getStyleValue;
c3_chart_internal_fn.init = function () {
var $$ = this, config = $$.config;
......
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