]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Enforce spaces around infix/unary words operators (#4547)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 22 Jul 2017 12:13:09 +0000 (14:13 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jul 2017 12:13:09 +0000 (14:13 +0200)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.

http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops

35 files changed:
.eslintrc
gulpfile.js
samples/charts/area/analyser.js
samples/utils.js
src/controllers/controller.bar.js
src/controllers/controller.line.js
src/core/core.animation.js
src/core/core.controller.js
src/core/core.datasetController.js
src/core/core.element.js
src/core/core.helpers.js
src/core/core.layoutService.js
src/core/core.plugin.js
src/core/core.scale.js
src/elements/element.point.js
src/elements/element.rectangle.js
src/helpers/helpers.canvas.js
src/helpers/helpers.core.js
src/helpers/helpers.options.js
src/helpers/helpers.time.js
src/platforms/platform.dom.js
src/plugins/plugin.filler.js
src/plugins/plugin.legend.js
src/plugins/plugin.title.js
src/scales/scale.logarithmic.js
src/scales/scale.radialLinear.js
src/scales/scale.time.js
test/jasmine.matchers.js
test/jasmine.utils.js
test/specs/controller.bubble.tests.js
test/specs/core.controller.tests.js
test/specs/global.deprecations.tests.js
test/specs/helpers.core.tests.js
test/specs/helpers.easing.tests.js
test/specs/platform.dom.tests.js

index fdf1951dd665ddb41e9ef7ccfe7b61c02a12c577..aa4cdbb3b715bcc327c22f082846c08066dcfff6 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -197,8 +197,8 @@ rules:
   space-before-blocks: [2, always]
   space-before-function-paren: [2, never]
   space-in-parens: [2, never]
-  space-infix-ops: 0
-  space-unary-ops: 0
+  space-infix-ops: 2
+  space-unary-ops: [2, {words: true, nonwords: false}]
   spaced-comment: [2, always]
   unicode-bom: 0
   wrap-regex: 2
index ff3cce5b6554c2bab0c6ad42713b4964ec708d7a..2ae49d77d0579f1a21ef2073987732818798bfbf 100644 (file)
@@ -23,7 +23,6 @@ var package = require('./package.json');
 
 var srcDir = './src/';
 var outDir = './dist/';
-var testDir = './test/';
 
 var header = "/*!\n" +
   " * Chart.js\n" +
@@ -128,8 +127,9 @@ function packageTask() {
 
 function lintTask() {
   var files = [
-    srcDir + '**/*.js',
-    testDir + '**/*.js'
+    'samples/**/*.js',
+    'src/**/*.js',
+    'test/**/*.js'
   ];
 
   // NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict
@@ -174,8 +174,8 @@ function startTest() {
     './test/jasmine.index.js',
     './src/**/*.js',
   ].concat(
-    argv.inputs?
-      argv.inputs.split(';'):
+    argv.inputs ?
+      argv.inputs.split(';') :
       ['./test/specs/**/*.js']
   );
 }
index f9d001af57ef226226535166491536c566c5378f..e4ed8e90b2474320d7e658ecf29aae82e82df0b9 100644 (file)
@@ -20,7 +20,7 @@
                                return;
                        }
 
-                       for (i=0, ilen=datasets.length; i<ilen; ++i) {
+                       for (i = 0, ilen = datasets.length; i < ilen; ++i) {
                                meta = chart.getDatasetMeta(i).$filler;
                                if (meta) {
                                        dataset = datasets[i];
index dc5bd12aea2d07ba8de56684e5ea1809fa838bf0..b6ea8d7b95d188f1624495f0e742e8282488fbf2 100644 (file)
@@ -41,8 +41,8 @@ window.randomScalingFactor = function() {
 
                rand: function(min, max) {
                        var seed = this._seed;
-                       min = min === undefined? 0 : min;
-                       max = max === undefined? 1 : max;
+                       min = min === undefined ? 0 : min;
+                       max = max === undefined ? 1 : max;
                        this._seed = (seed * 9301 + 49297) % 233280;
                        return min + (this._seed / 233280) * (max - min);
                },
@@ -59,7 +59,7 @@ window.randomScalingFactor = function() {
                        var data = [];
                        var i, value;
 
-                       for (i=0; i<count; ++i) {
+                       for (i = 0; i < count; ++i) {
                                value = (from[i] || 0) + this.rand(min, max);
                                if (this.rand() <= continuity) {
                                        data.push(Math.round(dfactor * value) / dfactor);
@@ -76,14 +76,14 @@ window.randomScalingFactor = function() {
                        var min = cfg.min || 0;
                        var max = cfg.max || 100;
                        var count = cfg.count || 8;
-                       var step = (max-min) / count;
+                       var step = (max - min) / count;
                        var decimals = cfg.decimals || 8;
                        var dfactor = Math.pow(10, decimals) || 0;
                        var prefix = cfg.prefix || '';
                        var values = [];
                        var i;
 
-                       for (i=min; i<max; i+=step) {
+                       for (i = min; i < max; i += step) {
                                values.push(prefix + Math.round(dfactor * i) / dfactor);
                        }
 
@@ -97,8 +97,8 @@ window.randomScalingFactor = function() {
                        var values = [];
                        var i, value;
 
-                       for (i=0; i<count; ++i) {
-                               value = Months[Math.ceil(i)%12];
+                       for (i = 0; i < count; ++i) {
+                               value = Months[Math.ceil(i) % 12];
                                values.push(value.substring(0, section));
                        }
 
@@ -106,7 +106,7 @@ window.randomScalingFactor = function() {
                },
 
                transparentize: function(color, opacity) {
-                       var alpha = opacity === undefined? 0.5 : 1 - opacity;
+                       var alpha = opacity === undefined ? 0.5 : 1 - opacity;
                        return Chart.helpers.color(color).alpha(alpha).rgbString();
                },
 
index 637d589d1ea77b84c1cdab52bc3b7996ccabbddb..dc410e97f805042b5cad283949fd23825bd4ee8a 100644 (file)
@@ -156,11 +156,11 @@ module.exports = function(Chart) {
                        var ipixels = me.calculateBarIndexPixels(me.index, index, ruler);
 
                        model.horizontal = horizontal;
-                       model.base = reset? base : vpixels.base;
-                       model.x = horizontal? reset? base : vpixels.head : ipixels.center;
-                       model.y = horizontal? ipixels.center : reset? base : vpixels.head;
-                       model.height = horizontal? ipixels.size : undefined;
-                       model.width = horizontal? undefined : ipixels.size;
+                       model.base = reset ? base : vpixels.base;
+                       model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;
+                       model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;
+                       model.height = horizontal ? ipixels.size : undefined;
+                       model.width = horizontal ? undefined : ipixels.size;
                },
 
                /**
@@ -200,7 +200,7 @@ module.exports = function(Chart) {
                        var chart = me.chart;
                        var scale = me.getIndexScale();
                        var stacked = scale.options.stacked;
-                       var ilen = last === undefined? chart.data.datasets.length : last + 1;
+                       var ilen = last === undefined ? chart.data.datasets.length : last + 1;
                        var stacks = [];
                        var i, meta;
 
@@ -233,7 +233,7 @@ module.exports = function(Chart) {
                        var scale = me.getIndexScale();
                        var options = scale.options;
                        var stackCount = me.getStackCount();
-                       var fullSize = scale.isHorizontal()? scale.width : scale.height;
+                       var fullSize = scale.isHorizontal() ? scale.width : scale.height;
                        var tickSize = fullSize / scale.ticks.length;
                        var categorySize = tickSize * options.categoryPercentage;
                        var fullBarSize = categorySize / stackCount;
@@ -311,7 +311,7 @@ module.exports = function(Chart) {
                        var base = scale.getPixelForValue(null, index, datasetIndex, isCombo);
                        var size = ruler.barSize;
 
-                       base -= isCombo? ruler.tickSize / 2 : 0;
+                       base -= isCombo ? ruler.tickSize / 2 : 0;
                        base += ruler.fullBarSize * stackIndex;
                        base += ruler.categorySpacing / 2;
                        base += ruler.barSpacing / 2;
@@ -335,7 +335,7 @@ module.exports = function(Chart) {
 
                        helpers.canvas.clipArea(chart.ctx, chart.chartArea);
 
-                       for (; i<ilen; ++i) {
+                       for (; i < ilen; ++i) {
                                d = dataset.data[i];
                                if (d !== null && d !== undefined && !isNaN(d)) {
                                        rects[i].draw();
index dd7d01d601886ecf01e45c6f1df3ad2f037c6a67..8fe352ed40a331910a44c1f78e9b182a153402fe 100644 (file)
@@ -86,7 +86,7 @@ module.exports = function(Chart) {
                        }
 
                        // Update Points
-                       for (i=0, ilen=points.length; i<ilen; ++i) {
+                       for (i = 0, ilen = points.length; i < ilen; ++i) {
                                me.updateElement(points[i], i, reset);
                        }
 
@@ -95,7 +95,7 @@ module.exports = function(Chart) {
                        }
 
                        // Now pivot the point for animation
-                       for (i=0, ilen=points.length; i<ilen; ++i) {
+                       for (i = 0, ilen = points.length; i < ilen; ++i) {
                                points[i].pivot();
                        }
                },
@@ -296,7 +296,7 @@ module.exports = function(Chart) {
                        helpers.canvas.unclipArea(chart.ctx);
 
                        // Draw the points
-                       for (; i<ilen; ++i) {
+                       for (; i < ilen; ++i) {
                                points[i].draw(area);
                        }
                },
index 17d8cb554e5c12392602d239322c1773f48dcb2e..af746588e60f4b455a514f0b2a8edeb088cf94b1 100644 (file)
@@ -49,7 +49,7 @@ module.exports = function(Chart) {
                                chart.animating = true;
                        }
 
-                       for (i=0, ilen=animations.length; i < ilen; ++i) {
+                       for (i = 0, ilen = animations.length; i < ilen; ++i) {
                                if (animations[i].chart === chart) {
                                        animations[i] = animation;
                                        return;
index 54de51d773a6dfa38e3b4783cc433f7a20225f8d..1dbf90f0162d11c3797310c9ff5d212c0c6cbe8a 100644 (file)
@@ -82,7 +82,7 @@ module.exports = function(Chart) {
                        me.config = config;
                        me.width = width;
                        me.height = height;
-                       me.aspectRatio = height? width / height : null;
+                       me.aspectRatio = height ? width / height : null;
                        me.options = config.options;
                        me._bufferedRender = false;
 
@@ -546,7 +546,7 @@ module.exports = function(Chart) {
                transition: function(easingValue) {
                        var me = this;
 
-                       for (var i=0, ilen=(me.data.datasets || []).length; i<ilen; ++i) {
+                       for (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) {
                                if (me.isDatasetVisible(i)) {
                                        me.getDatasetMeta(i).controller.transition(easingValue);
                                }
@@ -568,7 +568,7 @@ module.exports = function(Chart) {
                        }
 
                        // Draw datasets reversed to support proper line stacking
-                       for (var i=(me.data.datasets || []).length - 1; i >= 0; --i) {
+                       for (var i = (me.data.datasets || []).length - 1; i >= 0; --i) {
                                if (me.isDatasetVisible(i)) {
                                        me.drawDataset(i, easingValue);
                                }
@@ -652,7 +652,7 @@ module.exports = function(Chart) {
 
                getVisibleDatasetCount: function() {
                        var count = 0;
-                       for (var i = 0, ilen = this.data.datasets.length; i<ilen; ++i) {
+                       for (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
                                if (this.isDatasetVisible(i)) {
                                        count++;
                                }
@@ -665,7 +665,7 @@ module.exports = function(Chart) {
 
                        // meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,
                        // the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.
-                       return typeof meta.hidden === 'boolean'? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
+                       return typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
                },
 
                generateLegend: function() {
@@ -762,10 +762,10 @@ module.exports = function(Chart) {
                },
 
                updateHoverStyle: function(elements, mode, enabled) {
-                       var method = enabled? 'setHoverStyle' : 'removeHoverStyle';
+                       var method = enabled ? 'setHoverStyle' : 'removeHoverStyle';
                        var element, i, ilen;
 
-                       for (i=0, ilen=elements.length; i<ilen; ++i) {
+                       for (i = 0, ilen = elements.length; i < ilen; ++i) {
                                element = elements[i];
                                if (element) {
                                        this.getDatasetMeta(element._datasetIndex).controller[method](element);
index a74612421ee72e3a95dd816bd33b30375445abfd..187e8394210a5514b1bb65617b9854e498e5b8e8 100644 (file)
@@ -170,7 +170,7 @@ module.exports = function(Chart) {
                        var metaData = meta.data;
                        var i, ilen;
 
-                       for (i=0, ilen=data.length; i<ilen; ++i) {
+                       for (i = 0, ilen = data.length; i < ilen; ++i) {
                                metaData[i] = metaData[i] || me.createMetaData(i);
                        }
 
@@ -214,7 +214,7 @@ module.exports = function(Chart) {
                        var ilen = elements.length;
                        var i = 0;
 
-                       for (; i<ilen; ++i) {
+                       for (; i < ilen; ++i) {
                                elements[i].transition(easingValue);
                        }
 
@@ -233,7 +233,7 @@ module.exports = function(Chart) {
                                meta.dataset.draw();
                        }
 
-                       for (; i<ilen; ++i) {
+                       for (; i < ilen; ++i) {
                                elements[i].draw();
                        }
                },
@@ -284,7 +284,7 @@ module.exports = function(Chart) {
                 * @private
                 */
                insertElements: function(start, count) {
-                       for (var i=0; i<count; ++i) {
+                       for (var i = 0; i < count; ++i) {
                                this.addElementAndReset(start + i);
                        }
                },
@@ -293,7 +293,7 @@ module.exports = function(Chart) {
                 * @private
                 */
                onDataPush: function() {
-                       this.insertElements(this.getDataset().data.length-1, arguments.length);
+                       this.insertElements(this.getDataset().data.length - 1, arguments.length);
                },
 
                /**
index 016bf5d9e472a6c4674138541f9f15754206bfc7..2ca60692b973d6e2063ecbae4399013299bc7bda 100644 (file)
@@ -7,7 +7,7 @@ function interpolate(start, view, model, ease) {
        var keys = Object.keys(model);
        var i, ilen, key, actual, origin, target, type, c0, c1;
 
-       for (i=0, ilen=keys.length; i<ilen; ++i) {
+       for (i = 0, ilen = keys.length; i < ilen; ++i) {
                key = keys[i];
 
                target = model[key];
@@ -30,9 +30,9 @@ function interpolate(start, view, model, ease) {
 
                origin = start[key];
 
-               type = typeof(target);
+               type = typeof target;
 
-               if (type === typeof(origin)) {
+               if (type === typeof origin) {
                        if (type === 'string') {
                                c0 = color(origin);
                                if (c0.valid) {
index 90e116d2ceed3172ab8cd399d711a761f02a65ab..98452962e2c1b51ecefcc9c92f56c4946ede99e7 100644 (file)
@@ -52,7 +52,7 @@ module.exports = function(Chart) {
 
                                        for (i = 0; i < slen; ++i) {
                                                scale = source[key][i];
-                                               type = helpers.valueOrDefault(scale.type, key === 'xAxes'? 'category' : 'linear');
+                                               type = helpers.valueOrDefault(scale.type, key === 'xAxes' ? 'category' : 'linear');
 
                                                if (i >= target[key].length) {
                                                        target[key].push({});
@@ -88,12 +88,12 @@ module.exports = function(Chart) {
 
                return filtered;
        };
-       helpers.findIndex = Array.prototype.findIndex?
+       helpers.findIndex = Array.prototype.findIndex ?
                function(array, callback, scope) {
                        return array.findIndex(callback, scope);
                } :
                function(array, callback, scope) {
-                       scope = scope === undefined? array : scope;
+                       scope = scope === undefined ? array : scope;
                        for (var i = 0, ilen = array.length; i < ilen; ++i) {
                                if (callback.call(scope, array[i], i, array)) {
                                        return i;
@@ -175,7 +175,7 @@ module.exports = function(Chart) {
                        return min;
                }, Number.POSITIVE_INFINITY);
        };
-       helpers.sign = Math.sign?
+       helpers.sign = Math.sign ?
                function(x) {
                        return Math.sign(x);
                } :
@@ -186,7 +186,7 @@ module.exports = function(Chart) {
                        }
                        return x > 0 ? 1 : -1;
                };
-       helpers.log10 = Math.log10?
+       helpers.log10 = Math.log10 ?
                function(x) {
                        return Math.log10(x);
                } :
@@ -446,7 +446,7 @@ module.exports = function(Chart) {
        // Private helper function to convert max-width/max-height values that may be percentages into a number
        function parseMaxStyle(styleValue, node, parentProperty) {
                var valueInPixels;
-               if (typeof(styleValue) === 'string') {
+               if (typeof styleValue === 'string') {
                        valueInPixels = parseInt(styleValue, 10);
 
                        if (styleValue.indexOf('%') !== -1) {
@@ -484,8 +484,8 @@ module.exports = function(Chart) {
 
                if (hasCNode || hasCContainer) {
                        return Math.min(
-                               hasCNode? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,
-                               hasCContainer? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);
+                               hasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,
+                               hasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);
                }
 
                return 'none';
@@ -504,7 +504,7 @@ module.exports = function(Chart) {
                var paddingRight = parseInt(helpers.getStyle(container, 'padding-right'), 10);
                var w = container.clientWidth - paddingLeft - paddingRight;
                var cw = helpers.getConstraintWidth(domNode);
-               return isNaN(cw)? w : Math.min(w, cw);
+               return isNaN(cw) ? w : Math.min(w, cw);
        };
        helpers.getMaximumHeight = function(domNode) {
                var container = domNode.parentNode;
@@ -512,7 +512,7 @@ module.exports = function(Chart) {
                var paddingBottom = parseInt(helpers.getStyle(container, 'padding-bottom'), 10);
                var h = container.clientHeight - paddingTop - paddingBottom;
                var ch = helpers.getConstraintHeight(domNode);
-               return isNaN(ch)? h : Math.min(h, ch);
+               return isNaN(ch) ? h : Math.min(h, ch);
        };
        helpers.getStyle = function(el, property) {
                return el.currentStyle ?
@@ -604,7 +604,7 @@ module.exports = function(Chart) {
                return numberOfLines;
        };
 
-       helpers.color = !color?
+       helpers.color = !color ?
                function(value) {
                        console.error('Color.js not found!');
                        return value;
index 98907de27d3bb08e58c38349bebc1f4460d71e51..5649f113dc234241836581c52df5006995a8f091 100644 (file)
@@ -75,7 +75,7 @@ module.exports = function(Chart) {
                 * @param {Object} layoutItem - the item to remove from the layout
                 */
                removeBox: function(chart, layoutItem) {
-                       var index = chart.boxes? chart.boxes.indexOf(layoutItem) : -1;
+                       var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
                        if (index !== -1) {
                                chart.boxes.splice(index, 1);
                        }
@@ -93,7 +93,7 @@ module.exports = function(Chart) {
                        var i = 0;
                        var prop;
 
-                       for (; i<ilen; ++i) {
+                       for (; i < ilen; ++i) {
                                prop = props[i];
                                if (options.hasOwnProperty(prop)) {
                                        item[prop] = options[prop];
index 484b694f92ca7cf2e121426dec354350db1ae25b..399075b812cf532c922b741d2eff9f4221f766b0 100644 (file)
@@ -102,7 +102,7 @@ module.exports = function(Chart) {
                        var ilen = descriptors.length;
                        var i, descriptor, plugin, params, method;
 
-                       for (i=0; i<ilen; ++i) {
+                       for (i = 0; i < ilen; ++i) {
                                descriptor = descriptors[i];
                                plugin = descriptor.plugin;
                                method = plugin[hook];
index 18c04bd99d524e296a53a64b624e9c95f07f416f..07fc51bd6bd7d94294fb319382e5ba8a21898346 100644 (file)
@@ -378,8 +378,8 @@ module.exports = function(Chart) {
                                        // Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned which means that the right padding is dominated
                                        // by the font height
                                        if (me.labelRotation !== 0) {
-                                               me.paddingLeft = opts.position === 'bottom'? (cosRotation * firstLabelWidth) + 3: (cosRotation * lineSpace) + 3; // add 3 px to move away from canvas edges
-                                               me.paddingRight = opts.position === 'bottom'? (cosRotation * lineSpace) + 3: (cosRotation * lastLabelWidth) + 3;
+                                               me.paddingLeft = opts.position === 'bottom' ? (cosRotation * firstLabelWidth) + 3 : (cosRotation * lineSpace) + 3; // add 3 px to move away from canvas edges
+                                               me.paddingRight = opts.position === 'bottom' ? (cosRotation * lineSpace) + 3 : (cosRotation * lastLabelWidth) + 3;
                                        } else {
                                                me.paddingLeft = firstLabelWidth / 2 + 3; // add 3 px to move away from canvas edges
                                                me.paddingRight = lastLabelWidth / 2 + 3;
@@ -438,7 +438,7 @@ module.exports = function(Chart) {
                                return NaN;
                        }
                        // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
-                       if (typeof(rawValue) === 'number' && !isFinite(rawValue)) {
+                       if (typeof rawValue === 'number' && !isFinite(rawValue)) {
                                return NaN;
                        }
                        // If it is in fact an object, dive in one more level
@@ -627,13 +627,13 @@ module.exports = function(Chart) {
 
                                        if (options.position === 'bottom') {
                                                // bottom
-                                               textBaseline = !isRotated? 'top':'middle';
-                                               textAlign = !isRotated? 'center': 'right';
+                                               textBaseline = !isRotated ? 'top' : 'middle';
+                                               textAlign = !isRotated ? 'center' : 'right';
                                                labelY = me.top + labelYOffset;
                                        } else {
                                                // top
-                                               textBaseline = !isRotated? 'bottom':'middle';
-                                               textAlign = !isRotated? 'center': 'left';
+                                               textBaseline = !isRotated ? 'bottom' : 'middle';
+                                               textAlign = !isRotated ? 'center' : 'left';
                                                labelY = me.bottom - labelYOffset;
                                        }
 
index 919c648ec3f5e19dfef15d87c0a2f7a226967de1..d5116a259c5b8d96c3bf96e0d7e69c1d1fb26e4b 100644 (file)
@@ -85,18 +85,18 @@ module.exports = Element.extend({
 
                // Cliping for Points.
                // going out from inner charArea?
-               if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right*errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom*errMargin < model.y))) {
+               if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right * errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom * errMargin < model.y))) {
                        // Point fade out
                        if (model.x < chartArea.left) {
                                ratio = (x - model.x) / (chartArea.left - model.x);
-                       } else if (chartArea.right*errMargin < model.x) {
+                       } else if (chartArea.right * errMargin < model.x) {
                                ratio = (model.x - x) / (model.x - chartArea.right);
                        } else if (model.y < chartArea.top) {
                                ratio = (y - model.y) / (chartArea.top - model.y);
-                       } else if (chartArea.bottom*errMargin < model.y) {
+                       } else if (chartArea.bottom * errMargin < model.y) {
                                ratio = (model.y - y) / (model.y - chartArea.bottom);
                        }
-                       ratio = Math.round(ratio*100) / 100;
+                       ratio = Math.round(ratio * 100) / 100;
                        ctx.strokeStyle = color(ctx.strokeStyle).alpha(ratio).rgbString();
                        ctx.fillStyle = color(ctx.fillStyle).alpha(ratio).rgbString();
                }
index c4322063f7d16112293cf1781e2ba25e10b3aba3..ef59ac0dd62d5937a08cb59c79982791a3028871 100644 (file)
@@ -66,7 +66,7 @@ module.exports = Element.extend({
                        top = vm.y;
                        bottom = vm.base;
                        signX = 1;
-                       signY = bottom > top? 1: -1;
+                       signY = bottom > top ? 1 : -1;
                        borderSkipped = vm.borderSkipped || 'bottom';
                } else {
                        // horizontal bar
@@ -74,7 +74,7 @@ module.exports = Element.extend({
                        right = vm.x;
                        top = vm.y - vm.height / 2;
                        bottom = vm.y + vm.height / 2;
-                       signX = right > left? 1: -1;
+                       signX = right > left ? 1 : -1;
                        signY = 1;
                        borderSkipped = vm.borderSkipped || 'left';
                }
@@ -84,13 +84,13 @@ module.exports = Element.extend({
                if (borderWidth) {
                        // borderWidth shold be less than bar width and bar height.
                        var barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom));
-                       borderWidth = borderWidth > barSize? barSize: borderWidth;
+                       borderWidth = borderWidth > barSize ? barSize : borderWidth;
                        var halfStroke = borderWidth / 2;
                        // Adjust borderWidth when bar top position is near vm.base(zero).
-                       var borderLeft = left + (borderSkipped !== 'left'? halfStroke * signX: 0);
-                       var borderRight = right + (borderSkipped !== 'right'? -halfStroke * signX: 0);
-                       var borderTop = top + (borderSkipped !== 'top'? halfStroke * signY: 0);
-                       var borderBottom = bottom + (borderSkipped !== 'bottom'? -halfStroke * signY: 0);
+                       var borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0);
+                       var borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0);
+                       var borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0);
+                       var borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0);
                        // not become a vertical line?
                        if (borderLeft !== borderRight) {
                                top = borderTop;
index bf508dc7f2c2708de2d961acd919006559c31f23..54414f694c7a3c871c853b15470263c969fe2ee4 100644 (file)
@@ -27,8 +27,8 @@ var exports = module.exports = {
         */
        roundedRect: function(ctx, x, y, width, height, radius) {
                if (radius) {
-                       var rx = Math.min(radius, width/2);
-                       var ry = Math.min(radius, height/2);
+                       var rx = Math.min(radius, width / 2);
+                       var ry = Math.min(radius, height / 2);
 
                        ctx.moveTo(x + rx, y);
                        ctx.lineTo(x + width - rx, y);
@@ -180,10 +180,10 @@ var exports = module.exports = {
                }
 
                ctx.bezierCurveTo(
-                       flip? previous.controlPointPreviousX : previous.controlPointNextX,
-                       flip? previous.controlPointPreviousY : previous.controlPointNextY,
-                       flip? target.controlPointNextX : target.controlPointPreviousX,
-                       flip? target.controlPointNextY : target.controlPointPreviousY,
+                       flip ? previous.controlPointPreviousX : previous.controlPointNextX,
+                       flip ? previous.controlPointPreviousY : previous.controlPointNextY,
+                       flip ? target.controlPointNextX : target.controlPointPreviousX,
+                       flip ? target.controlPointNextY : target.controlPointPreviousY,
                        target.x,
                        target.y);
        }
index 0a603a28261470145174443b2b72d39151715d6f..1ada7a754b10e3197cecd28b021d30db05a36710 100644 (file)
@@ -37,7 +37,7 @@ var helpers = {
         * @returns {Boolean}
         * @function
         */
-       isArray: Array.isArray? Array.isArray : function(value) {
+       isArray: Array.isArray ? Array.isArray : function(value) {
                return Object.prototype.toString.call(value) === '[object Array]';
        },
 
@@ -58,7 +58,7 @@ var helpers = {
         * @returns {*}
         */
        valueOrDefault: function(value, defaultValue) {
-               return typeof value === 'undefined'? defaultValue : value;
+               return typeof value === 'undefined' ? defaultValue : value;
        },
 
        /**
@@ -69,7 +69,7 @@ var helpers = {
         * @returns {*}
         */
        valueAtIndexOrDefault: function(value, index, defaultValue) {
-               return helpers.valueOrDefault(helpers.isArray(value)? value[index] : value, defaultValue);
+               return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);
        },
 
        /**
@@ -131,7 +131,7 @@ var helpers = {
                        return false;
                }
 
-               for (i = 0, ilen=a0.length; i < ilen; ++i) {
+               for (i = 0, ilen = a0.length; i < ilen; ++i) {
                        v0 = a0[i];
                        v1 = a1[i];
 
@@ -164,7 +164,7 @@ var helpers = {
                        var klen = keys.length;
                        var k = 0;
 
-                       for (; k<klen; ++k) {
+                       for (; k < klen; ++k) {
                                target[keys[k]] = helpers.clone(source[keys[k]]);
                        }
 
@@ -215,7 +215,7 @@ var helpers = {
         * @returns {Object} The `target` object.
         */
        merge: function(target, source, options) {
-               var sources = helpers.isArray(source)? source : [source];
+               var sources = helpers.isArray(source) ? source : [source];
                var ilen = sources.length;
                var merge, i, keys, klen, k;
 
@@ -226,14 +226,14 @@ var helpers = {
                options = options || {};
                merge = options.merger || helpers._merger;
 
-               for (i=0; i<ilen; ++i) {
+               for (i = 0; i < ilen; ++i) {
                        source = sources[i];
                        if (!helpers.isObject(source)) {
                                continue;
                        }
 
                        keys = Object.keys(source);
-                       for (k=0, klen = keys.length; k<klen; ++k) {
+                       for (k = 0, klen = keys.length; k < klen; ++k) {
                                merge(keys[k], target, source, options);
                        }
                }
index 15e14c16a5fcc1ac1f46516227fe1621d05a18f1..2c9dc759b74c78b516dce68e90e19ec0d94f367c 100644 (file)
@@ -15,7 +15,7 @@ module.exports = {
         * @since 2.7.0
         */
        toLineHeight: function(value, size) {
-               var matches = (''+value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
+               var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
                if (!matches || matches[1] === 'normal') {
                        return size * 1.2;
                }
index b667df54c8a428251eafa9b8f1ded1ed0b19b208..404708ba7c4c2061872dcf787949c342f7477ad6 100644 (file)
@@ -1,7 +1,7 @@
 'use strict';
 
 var moment = require('moment');
-moment = typeof(moment) === 'function' ? moment : window.moment;
+moment = typeof moment === 'function' ? moment : window.moment;
 
 var helpers = require('./helpers.core');
 
@@ -55,7 +55,7 @@ function generateTicksNiceRange(options, dataRange, niceRange) {
        var ticks = [];
        if (options.maxTicks) {
                var stepSize = options.stepSize;
-               var startTick = helpers.isNullOrUndef(options.min)? niceRange.min : options.min;
+               var startTick = helpers.isNullOrUndef(options.min) ? niceRange.min : options.min;
                var majorUnit = options.majorUnit;
                var majorUnitStart = majorUnit ? moment(startTick).add(1, majorUnit).startOf(majorUnit) : startTick;
                var startRange = majorUnitStart.valueOf() - startTick;
index d0895ae9674de584c8a387667362cc59ccdf4a20..25cd1551d3def9e1e1260cd2bfd71da3bb6e4400 100644 (file)
@@ -39,7 +39,7 @@ var eventTypeMap = {
 function readUsedSize(element, property) {
        var value = helpers.getStyle(element, property);
        var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
-       return matches? Number(matches[1]) : undefined;
+       return matches ? Number(matches[1]) : undefined;
 }
 
 /**
@@ -119,7 +119,7 @@ var supportsEventListenerOptions = (function() {
 
 // Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.
 // https://github.com/chartjs/Chart.js/issues/4287
-var eventListenerOptions = supportsEventListenerOptions? {passive: true} : false;
+var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
 
 function addEventListener(node, type, listener) {
        node.addEventListener(type, listener, eventListenerOptions);
@@ -134,8 +134,8 @@ function createEvent(type, chart, x, y, nativeEvent) {
                type: type,
                chart: chart,
                native: nativeEvent || null,
-               x: x !== undefined? x : null,
-               y: y !== undefined? y : null,
+               x: x !== undefined ? x : null,
+               y: y !== undefined ? y : null,
        };
 }
 
@@ -149,18 +149,18 @@ function createResizer(handler) {
        var iframe = document.createElement('iframe');
        iframe.className = 'chartjs-hidden-iframe';
        iframe.style.cssText =
-               'display:block;'+
-               'overflow:hidden;'+
-               'border:0;'+
-               'margin:0;'+
-               'top:0;'+
-               'left:0;'+
-               'bottom:0;'+
-               'right:0;'+
-               'height:100%;'+
-               'width:100%;'+
-               'position:absolute;'+
-               'pointer-events:none;'+
+               'display:block;' +
+               'overflow:hidden;' +
+               'border:0;' +
+               'margin:0;' +
+               'top:0;' +
+               'left:0;' +
+               'bottom:0;' +
+               'right:0;' +
+               'height:100%;' +
+               'width:100%;' +
+               'position:absolute;' +
+               'pointer-events:none;' +
                'z-index:-1;';
 
        // Prevent the iframe to gain focus on tab.
index b42a570f6c44a8b09a0644ee02d3aef80ee22191..cf022654284f6772e498735974804c4e2468ac47 100644 (file)
@@ -29,20 +29,20 @@ module.exports = function() {
                        var points = (visible && meta.dataset._children) || [];
                        var length = points.length || 0;
 
-                       return !length? null : function(point, i) {
+                       return !length ? null : function(point, i) {
                                return (i < length && points[i]._view) || null;
                        };
                },
 
                boundary: function(source) {
                        var boundary = source.boundary;
-                       var x = boundary? boundary.x : null;
-                       var y = boundary? boundary.y : null;
+                       var x = boundary ? boundary.x : null;
+                       var y = boundary ? boundary.y : null;
 
                        return function(point) {
                                return {
-                                       x: x === null? point.x : x,
-                                       y: y === null? point.y : y,
+                                       x: x === null ? point.x : x,
+                                       y: y === null ? point.y : y,
                                };
                        };
                }
@@ -114,9 +114,9 @@ module.exports = function() {
                // controllers might still use it (e.g. the Smith chart).
 
                if (fill === 'start') {
-                       target = model.scaleBottom === undefined? scale.bottom : model.scaleBottom;
+                       target = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom;
                } else if (fill === 'end') {
-                       target = model.scaleTop === undefined? scale.top : model.scaleTop;
+                       target = model.scaleTop === undefined ? scale.top : model.scaleTop;
                } else if (model.scaleZero !== undefined) {
                        target = model.scaleZero;
                } else if (scale.getBasePosition) {
@@ -133,8 +133,8 @@ module.exports = function() {
                        if (typeof target === 'number' && isFinite(target)) {
                                horizontal = scale.isHorizontal();
                                return {
-                                       x: horizontal? target : null,
-                                       y: horizontal? null : target
+                                       x: horizontal ? target : null,
+                                       y: horizontal ? null : target
                                };
                        }
                }
@@ -201,16 +201,16 @@ module.exports = function() {
 
                // building first area curve (normal)
                ctx.moveTo(curve0[0].x, curve0[0].y);
-               for (i=1; i<len0; ++i) {
-                       helpers.canvas.lineTo(ctx, curve0[i-1], curve0[i]);
+               for (i = 1; i < len0; ++i) {
+                       helpers.canvas.lineTo(ctx, curve0[i - 1], curve0[i]);
                }
 
                // joining the two area curves
-               ctx.lineTo(curve1[len1-1].x, curve1[len1-1].y);
+               ctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y);
 
                // building opposite area curve (reverse)
-               for (i=len1-1; i>0; --i) {
-                       helpers.canvas.lineTo(ctx, curve1[i], curve1[i-1], true);
+               for (i = len1 - 1; i > 0; --i) {
+                       helpers.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true);
                }
        }
 
@@ -226,7 +226,7 @@ module.exports = function() {
                ctx.beginPath();
 
                for (i = 0, ilen = (count + !!loop); i < ilen; ++i) {
-                       index = i%count;
+                       index = i % count;
                        p0 = points[index]._view;
                        p1 = mapper(p0, index, view);
                        d0 = isDrawable(p0);
@@ -286,7 +286,7 @@ module.exports = function() {
                                sources.push(source);
                        }
 
-                       for (i=0; i<count; ++i) {
+                       for (i = 0; i < count; ++i) {
                                source = sources[i];
                                if (!source) {
                                        continue;
index aafe521d13798fb1fe9e31ec89a44d78715fe9bd..d41a2f51333dc06a48ec3a7854ee3e3c01301c35 100644 (file)
@@ -19,7 +19,7 @@ defaults._set('global', {
                        var meta = ci.getDatasetMeta(index);
 
                        // See controller.isDatasetVisible comment
-                       meta.hidden = meta.hidden === null? !ci.data.datasets[index].hidden : null;
+                       meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
 
                        // We hid a dataset ... rerender the chart
                        ci.update();
index 765c30f8722f457504f87cd1b8f634a16b0205e8..2f9c0bde0996af939b1b88067c0c73e752376300 100644 (file)
@@ -153,7 +153,7 @@ module.exports = function(Chart) {
                                        fontFamily = valueOrDefault(opts.fontFamily, globalDefaults.defaultFontFamily),
                                        titleFont = helpers.fontString(fontSize, fontStyle, fontFamily),
                                        lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize),
-                                       offset = lineHeight/2 + opts.padding,
+                                       offset = lineHeight / 2 + opts.padding,
                                        rotation = 0,
                                        titleX,
                                        titleY,
index 3d2b81c4e0ef8a5070084bb3371eff3736d5d26e..6a5d59eedee78a2aa22ae41ec1596b875768a25c 100644 (file)
@@ -206,7 +206,7 @@ module.exports = function(Chart) {
                                        } else if (newVal === me.minNotZero) {
                                                pixel = me.bottom - innerDimension * 0.02;
                                        } else {
-                                               pixel = me.bottom - innerDimension * 0.02 - (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero)));
+                                               pixel = me.bottom - innerDimension * 0.02 - (innerDimension * 0.98 / range * (helpers.log10(newVal) - helpers.log10(me.minNotZero)));
                                        }
                                } else if (me.end === 0 && tickOpts.reverse) {
                                        range = helpers.log10(me.start) - helpers.log10(me.minNotZero);
@@ -215,7 +215,7 @@ module.exports = function(Chart) {
                                        } else if (newVal === me.minNotZero) {
                                                pixel = me.top + innerDimension * 0.02;
                                        } else {
-                                               pixel = me.top + innerDimension * 0.02 + (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero)));
+                                               pixel = me.top + innerDimension * 0.02 + (innerDimension * 0.98 / range * (helpers.log10(newVal) - helpers.log10(me.minNotZero)));
                                        }
                                } else if (newVal === 0) {
                                        pixel = tickOpts.reverse ? me.top : me.bottom;
index 7b5f5a537b8eeae06eb26f89756dde4803bdcbdf..71adf790eee6567293d0c79401bbae9d914cc371 100644 (file)
@@ -222,7 +222,7 @@ module.exports = function(Chart) {
 
                        for (var i = 0; i < text.length; ++i) {
                                ctx.fillText(text[i], position.x, y);
-                               y+= spacing;
+                               y += spacing;
                        }
                } else {
                        ctx.fillText(text, position.x, position.y);
index 8b3dc97437bb8410a573471eb4ebeacf226f763a..2ffb6f9d2fb2aa6244db37c0df8d68fd58711a89 100644 (file)
@@ -2,7 +2,7 @@
 'use strict';
 
 var moment = require('moment');
-moment = typeof(moment) === 'function' ? moment : window.moment;
+moment = typeof moment === 'function' ? moment : window.moment;
 
 var defaults = require('../core/core.defaults');
 var helpers = require('../helpers/index');
@@ -45,7 +45,7 @@ function buildLookupTable(timestamps, min, max, linear) {
                items.push(max);
        }
 
-       for (i = 0, ilen = items.length; i<ilen; ++i) {
+       for (i = 0, ilen = items.length; i < ilen; ++i) {
                next = items[i + 1];
                prev = items[i - 1];
                curr = items[i];
@@ -331,8 +331,8 @@ module.exports = function(Chart) {
                        var majorFormat = me.majorDisplayFormat;
                        var majorTime = tick.clone().startOf(me.majorUnit).valueOf();
                        var major = majorUnit && majorFormat && time === majorTime;
-                       var formattedTick = tick.format(major? majorFormat : me.displayFormat);
-                       var tickOpts = major? options.ticks.major : options.ticks.minor;
+                       var formattedTick = tick.format(major ? majorFormat : me.displayFormat);
+                       var tickOpts = major ? options.ticks.major : options.ticks.minor;
                        var formatter = helpers.valueOrDefault(tickOpts.callback, tickOpts.userCallback);
 
                        if (formatter) {
index be976d213cbf66117a8fe62abd74df18a532f916..f216e1e1c019688a4f144031d041a902cd3a3260 100644 (file)
@@ -33,7 +33,7 @@ function buildPixelMatchPreview(actual, expected, diff, threshold, tolerance, co
                        'diff: ' + count + 'px ' +
                        '(' + toPercent(ratio) + '%)<br/>' +
                        'thr: ' + toPercent(threshold) + '%, ' +
-                       'tol: '+ toPercent(tolerance) + '%'
+                       'tol: ' + toPercent(tolerance) + '%'
                }
        ].forEach(function(values) {
                var item = document.createElement('div');
@@ -104,7 +104,7 @@ function toBeValidChart() {
                        }
 
                        return {
-                               message: message? message : 'Expected ' + actual + ' to be valid chart',
+                               message: message ? message : 'Expected ' + actual + ' to be valid chart',
                                pass: !message
                        };
                }
@@ -149,7 +149,7 @@ function toBeChartOfSize() {
                        }
 
                        return {
-                               message: message? message : 'Expected ' + actual + ' to be a chart of size ' + expected,
+                               message: message ? message : 'Expected ' + actual + ' to be a chart of size ' + expected,
                                pass: !message
                        };
                }
@@ -161,8 +161,8 @@ function toEqualImageData() {
                compare: function(actual, expected, opts) {
                        var message = null;
                        var debug = opts.debug || false;
-                       var tolerance = opts.tolerance === undefined? 0.001 : opts.tolerance;
-                       var threshold = opts.threshold === undefined? 0.1 : opts.threshold;
+                       var tolerance = opts.tolerance === undefined ? 0.001 : opts.tolerance;
+                       var threshold = opts.threshold === undefined ? 0.1 : opts.threshold;
                        var ctx, idata, ddata, w, h, count, ratio;
 
                        if (actual instanceof Chart) {
index 8d27485bf4bd8ccb3dbf16f9b0360d7d0252ca24..bb3f6445caba7889d1d101bc2eb736eb1b600322 100644 (file)
@@ -68,8 +68,8 @@ function acquireChart(config, options) {
 
        // by default, remove chart animation and auto resize
        config.options = config.options || {};
-       config.options.animation = config.options.animation === undefined? false : config.options.animation;
-       config.options.responsive = config.options.responsive === undefined? false : config.options.responsive;
+       config.options.animation = config.options.animation === undefined ? false : config.options.animation;
+       config.options.responsive = config.options.responsive === undefined ? false : config.options.responsive;
        config.options.defaultFontFamily = config.options.defaultFontFamily || 'Arial';
 
        wrapper.appendChild(canvas);
index 4914e1005b01de2e417e19d483b8421ae245591c..6212b0c3dc6368480390f7fa80d7e78f0690653a 100644 (file)
@@ -162,7 +162,7 @@ describe('Bubble controller tests', function() {
 
                chart.update();
 
-               for (var i=0; i<4; ++i) {
+               for (var i = 0; i < 4; ++i) {
                        expect(meta.data[i]._model).toEqual(jasmine.objectContaining({
                                backgroundColor: 'rgb(98, 98, 98)',
                                borderColor: 'rgb(8, 8, 8)',
index 3e04fbdac9c2993e6e6054dc6de780aef348ff61..c2038ac248d98566f36b911e4047072fdc59f5e7 100644 (file)
@@ -10,7 +10,7 @@ describe('Chart', function() {
                        setTimeout(callback, 50);
                };
 
-               Chart.helpers.addEvent(content, state !== 'complete'? 'load' : 'resize', handler);
+               Chart.helpers.addEvent(content, state !== 'complete' ? 'load' : 'resize', handler);
        }
 
        // https://github.com/chartjs/Chart.js/issues/2481
index 8c9608694eee5da16518c0d1539d79eb1f7be90a..7bc07ebde0b0419b9c14666c6b9da91da7018b11 100644 (file)
@@ -104,7 +104,7 @@ describe('Deprecations', function() {
 
                                var calls = ctx.getCalls();
                                expect(calls[0]).toEqual({name: 'beginPath', args: []});
-                               expect(calls[calls.length-1]).toEqual({name: 'closePath', args: []});
+                               expect(calls[calls.length - 1]).toEqual({name: 'closePath', args: []});
                                expect(Chart.helpers.canvas.roundedRect).toHaveBeenCalledWith(ctx, 10, 20, 30, 40, 5);
                        });
                });
@@ -172,7 +172,7 @@ describe('Deprecations', function() {
                                expect(proxy.canvas instanceof HTMLCanvasElement).toBeTruthy();
                                expect(proxy.ctx instanceof CanvasRenderingContext2D).toBeTruthy();
                                expect(proxy.currentDevicePixelRatio).toBe(window.devicePixelRatio || 1);
-                               expect(proxy.aspectRatio).toBe(140/320);
+                               expect(proxy.aspectRatio).toBe(140 / 320);
                                expect(proxy.height).toBe(320);
                                expect(proxy.width).toBe(140);
                        });
index bc79057b3ad71cf8b9080db607450b7562f30f3b..b13b7cad2af3b9e0d5f0c83df3fb1da2cda5c40c 100644 (file)
@@ -150,7 +150,7 @@ describe('Chart.helpers.core', function() {
                it('should return the value returned by fn', function() {
                        expect(helpers.callback(helpers.noop, [41])).toBe(undefined);
                        expect(helpers.callback(function(i) {
-                               return i+1;
+                               return i + 1;
                        }, [41])).toBe(42);
                });
        });
index b27655c9b75ae9b022fa3c728acb284442b16041..50240c9dda9d8583bd0db46c42eef92cb6120d45 100644 (file)
@@ -45,8 +45,8 @@ describe('Chart.helpers.easing', function() {
                        var values = [];
                        var i;
 
-                       for (i=0; i<=count; ++i) {
-                               values.push(Math.round(accuracy * fn(i/count)) / accuracy);
+                       for (i = 0; i <= count; ++i) {
+                               values.push(Math.round(accuracy * fn(i / count)) / accuracy);
                        }
 
                        return values;
index fa01fc566175cb33d91a4f3ad13e2727086558b4..97806e613ecdf1ef1b33ddaaab0c8b6b9c0d64eb 100644 (file)
@@ -10,7 +10,7 @@ describe('Platform.dom', function() {
                        setTimeout(callback, 50);
                };
 
-               Chart.helpers.addEvent(content, state !== 'complete'? 'load' : 'resize', handler);
+               Chart.helpers.addEvent(content, state !== 'complete' ? 'load' : 'resize', handler);
        }
 
        describe('context acquisition', function() {