Skip to content

Commit

Permalink
make bracket selectors work with quoted values
Browse files Browse the repository at this point in the history
that allows chart's root element to be something like '.chart[foo="5bar"]'
  • Loading branch information
IwfY authored and gordonwoodhull committed Mar 30, 2017
1 parent 8a754ac commit 175dc3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions spec/coordinate-grid-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ describe('dc.coordinateGridChart', function () {

describe('with a selector containing brackets', function () {
beforeEach(function () {
appendChartID('coordinate-grid').append('div').attr('class', 'chart').attr('foo', 'bar');
chart = dc.lineChart('#coordinate-grid .chart[foo=bar]')
appendChartID('coordinate-grid').append('div').attr('class', 'chart').attr('foo', '5bar');
chart = dc.lineChart('#coordinate-grid .chart[foo="5bar"]')
.width(500)
.height(150)
.dimension(dimension)
Expand All @@ -230,7 +230,7 @@ describe('dc.coordinateGridChart', function () {
chart.render();
});
it('should generate a valid clippath id', function () {
var rect = chart.select('defs #coordinate-grid--chart-foo-bar--clip rect');
var rect = chart.select('defs #coordinate-grid--chart-foo--5bar---clip rect');
expect(rect.empty()).toBeFalsy();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ dc.coordinateGridMixin = function (_chart) {
};

function getClipPathId () {
return _chart.anchorName().replace(/[ .#=\[\]]/g, '-') + '-clip';
return _chart.anchorName().replace(/[ .#=\[\]"]/g, '-') + '-clip';
}

/**
Expand Down

0 comments on commit 175dc3e

Please sign in to comment.