Skip to content

Commit 175dc3e

Browse files
IwfYgordonwoodhull
authored andcommitted
make bracket selectors work with quoted values
that allows chart's root element to be something like '.chart[foo="5bar"]'
1 parent 8a754ac commit 175dc3e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spec/coordinate-grid-chart-spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ describe('dc.coordinateGridChart', function () {
216216

217217
describe('with a selector containing brackets', function () {
218218
beforeEach(function () {
219-
appendChartID('coordinate-grid').append('div').attr('class', 'chart').attr('foo', 'bar');
220-
chart = dc.lineChart('#coordinate-grid .chart[foo=bar]')
219+
appendChartID('coordinate-grid').append('div').attr('class', 'chart').attr('foo', '5bar');
220+
chart = dc.lineChart('#coordinate-grid .chart[foo="5bar"]')
221221
.width(500)
222222
.height(150)
223223
.dimension(dimension)
@@ -230,7 +230,7 @@ describe('dc.coordinateGridChart', function () {
230230
chart.render();
231231
});
232232
it('should generate a valid clippath id', function () {
233-
var rect = chart.select('defs #coordinate-grid--chart-foo-bar--clip rect');
233+
var rect = chart.select('defs #coordinate-grid--chart-foo--5bar---clip rect');
234234
expect(rect.empty()).toBeFalsy();
235235
});
236236
});

src/coordinate-grid-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ dc.coordinateGridMixin = function (_chart) {
10691069
};
10701070

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

10751075
/**

0 commit comments

Comments
 (0)