c3js / c3

:bar_chart: A D3-based reusable chart library
http://c3js.org
MIT License
9.33k stars 1.39k forks source link

replace "spaces" in generateTargetClass #2723

Open tjohannto opened 4 years ago

tjohannto commented 4 years ago

Currently spaces are not replaces in generateTargetClass

ChartInternal.prototype.generateTargetClass = function (targetId) {
    return targetId || targetId === 0 ? ('-' + targetId).replace(/\s/g, '-') : '';
  };

I think /\W+/g would be better as it would also replace spaces.

ChartInternal.prototype.generateTargetClass = function (targetId) {
    return targetId || targetId === 0 ? ('-' + targetId).replace(/\W+/g, '-') : '';
};

Am I missing s.th.?