Skip to content

Commit a7074da

Browse files
author
Rashid Khan
committed
Use a filter function instead of string concatonation
1 parent 8992535 commit a7074da

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

src/ui/public/utils/escape_attr.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/ui/public/vislib/lib/dispatch.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import d3 from 'd3';
22
import _ from 'lodash';
33
import $ from 'jquery';
4-
import escapeAttr from 'ui/utils/escape_attr';
54
import SimpleEmitter from 'ui/utils/SimpleEmitter';
65
import VislibComponentsTooltipProvider from 'ui/vislib/components/Tooltip';
76
export default function DispatchClass(Private) {
@@ -231,7 +230,7 @@ export default function DispatchClass(Private) {
231230
Dispatch.prototype.highlightLegend = function (element) {
232231
var label = this.getAttribute('data-label');
233232
if (!label) return;
234-
$('[data-label]', element.parentNode).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5);
233+
$('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5);
235234
};
236235

237236
/**

src/ui/public/visualize/visualize_legend.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import _ from 'lodash';
22
import html from 'ui/visualize/visualize_legend.html';
33
import $ from 'jquery';
44
import d3 from 'd3';
5-
import escapeAttr from 'ui/utils/escape_attr';
65
import findByParam from 'ui/utils/find_by_param';
76
import VislibLibDataProvider from 'ui/vislib/lib/data';
87
import VislibComponentsColorColorProvider from 'ui/vislib/components/color/color';
@@ -31,7 +30,7 @@ uiModules.get('kibana')
3130
});
3231

3332
$scope.highlightSeries = function (label) {
34-
$('[data-label]', $elem.siblings()).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5);
33+
$('[data-label]', $elem.siblings()).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5);
3534
};
3635

3736
$scope.unhighlightSeries = function () {

0 commit comments

Comments
 (0)