From: Dan Vanderkam Date: Mon, 19 Dec 2011 20:32:12 +0000 (-0500) Subject: Enable "strict" mode -- and fix one missing "var" declaration. X-Git-Tag: v1.0.0~405 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=c0f54d4f7444bea88d6c26020c566b42b3fe45e5;p=dygraphs.git Enable "strict" mode -- and fix one missing "var" declaration. --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 5b2cac8..77d8cc4 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -23,7 +23,10 @@ * @param {Layout} layout The DygraphLayout object for this graph. * @constructor */ -DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { + +"use strict"; + +var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { this.dygraph_ = dygraph; this.layout = layout; diff --git a/dygraph-gviz.js b/dygraph-gviz.js index 5b81d7f..7e514a6 100644 --- a/dygraph-gviz.js +++ b/dygraph-gviz.js @@ -17,6 +17,8 @@ * - http://dygraphs.com/tests/annotation-gviz.html */ +"use strict"; + /** * A wrapper around Dygraph that implements the gviz API. * @param {Object} container The DOM object the visualization should live in. diff --git a/dygraph-interaction-model.js b/dygraph-interaction-model.js index 98d1411..4018769 100644 --- a/dygraph-interaction-model.js +++ b/dygraph-interaction-model.js @@ -10,6 +10,8 @@ * @author Robert Konigsberg (konigsberg@google.com) */ +"use strict"; + /** * A collection of functions to facilitate build custom interaction models. diff --git a/dygraph-layout.js b/dygraph-layout.js index 5fd6e52..7948686 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -9,6 +9,8 @@ * dygraphs. */ +"use strict"; + /** * Creates a new DygraphLayout object. * @@ -25,7 +27,7 @@ * * @constructor */ -DygraphLayout = function(dygraph) { +var DygraphLayout = function(dygraph) { this.dygraph_ = dygraph; this.datasets = new Array(); this.annotations = new Array(); diff --git a/dygraph-range-selector.js b/dygraph-range-selector.js index 15be96f..3b32d37 100644 --- a/dygraph-range-selector.js +++ b/dygraph-range-selector.js @@ -6,12 +6,14 @@ * a timeline range selector widget for dygraphs. */ +"use strict"; + /** * The DygraphRangeSelector class provides a timeline range selector widget. * @param {Dygraph} dygraph The dygraph object * @constructor */ -DygraphRangeSelector = function(dygraph) { +var DygraphRangeSelector = function(dygraph) { this.isIE_ = /MSIE/.test(navigator.userAgent) && !window.opera; this.isUsingExcanvas_ = dygraph.isUsingExcanvas_; this.dygraph_ = dygraph; diff --git a/dygraph-tickers.js b/dygraph-tickers.js index 0ca06e7..a17519e 100644 --- a/dygraph-tickers.js +++ b/dygraph-tickers.js @@ -58,6 +58,8 @@ * middle of the years. */ +"use strict"; + Dygraph.numericTicks = function(a, b, pixels, opts, dygraph, vals) { var pixels_per_tick = opts('pixelsPerLabel'); var ticks = []; diff --git a/dygraph-utils.js b/dygraph-utils.js index ddfda61..cebf950 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -11,6 +11,8 @@ * search) and generic DOM-manipulation functions. */ +"use strict"; + Dygraph.LOG_SCALE = 10; Dygraph.LN_TEN = Math.log(Dygraph.LOG_SCALE); @@ -604,7 +606,7 @@ Dygraph.clone = function(o) { Dygraph.createCanvas = function() { var canvas = document.createElement("canvas"); - isIE = (/MSIE/.test(navigator.userAgent) && !window.opera); + var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera); if (isIE && (typeof(G_vmlCanvasManager) != 'undefined')) { canvas = G_vmlCanvasManager.initElement(canvas); } diff --git a/dygraph.js b/dygraph.js index ed021cd..49843a4 100644 --- a/dygraph.js +++ b/dygraph.js @@ -43,6 +43,8 @@ */ +"use strict"; + /** * Creates an interactive, zoomable chart. * @@ -57,7 +59,7 @@ * whether the input data contains error ranges. For a complete list of * options, see http://dygraphs.com/options.html. */ -Dygraph = function(div, data, opts) { +var Dygraph = function(div, data, opts) { if (arguments.length > 0) { if (arguments.length == 4) { // Old versions of dygraphs took in the series labels as a constructor @@ -3202,4 +3204,4 @@ Dygraph.addAnnotationRule = function() { } // Older pages may still use this name. -DateGraph = Dygraph; +var DateGraph = Dygraph;