Skip to content

Commit 3f45a8f

Browse files
committed
stricter numeric check on icon height config
#2762 (comment)
1 parent ccba6e9 commit 3f45a8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/modebar/modebar.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
'use strict';
1111

1212
var d3 = require('d3');
13+
var isNumeric = require('fast-isnumeric');
1314

1415
var Lib = require('../../lib');
1516
var Icons = require('../../../build/ploticon');
@@ -175,8 +176,8 @@ proto.createButton = function(config) {
175176
* @Return {HTMLelement}
176177
*/
177178
proto.createIcon = function(thisIcon, name) {
178-
var iconHeight = thisIcon.height !== undefined ?
179-
thisIcon.height :
179+
var iconHeight = isNumeric(thisIcon.height) ?
180+
Number(thisIcon.height) :
180181
thisIcon.ascent - thisIcon.descent,
181182
svgNS = 'http://www.w3.org/2000/svg',
182183
icon = document.createElementNS(svgNS, 'svg'),

0 commit comments

Comments
 (0)