From: Dan Vanderkam Date: Sun, 1 Sep 2013 13:30:06 +0000 (-0400) Subject: generate-combined without warnings; tests pass; 87918 bytes output X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=b2257678681ea7065460a5de33f7b159f87334be;p=dygraphs.git generate-combined without warnings; tests pass; 87918 bytes output --- diff --git a/dygraph-gviz.js b/dygraph-gviz.js index 5287037..621e74f 100644 --- a/dygraph-gviz.js +++ b/dygraph-gviz.js @@ -17,8 +17,9 @@ * - http://dygraphs.com/tests/annotation-gviz.html */ -/*jshint globalstrict: true */ /*global Dygraph:false */ + +(function() { "use strict"; /** @@ -81,3 +82,5 @@ Dygraph.GVizChart.prototype.getSelection = function() { return selection; }; + +})(); diff --git a/dygraph.js b/dygraph.js index 4f09f31..d9695a2 100644 --- a/dygraph.js +++ b/dygraph.js @@ -151,10 +151,10 @@ Dygraph.prototype.init_ = function(div, file, opt_attrs) { // TODO(danvk): most of these should just stay in the attrs_ dictionary. this.maindiv_ = /** @type {!HTMLDivElement} */(div); this.file_ = file; - this.rollPeriod_ = attrs.rollPeriod || DEFAULT_ROLL_PERIOD; + this.rollPeriod_ = attrs['rollPeriod'] || DEFAULT_ROLL_PERIOD; this.previousVerticalX_ = -1; - this.fractions_ = attrs.fractions || false; - this.dateWindow_ = attrs.dateWindow || null; + this.fractions_ = attrs['fractions'] || false; + this.dateWindow_ = attrs['dateWindow'] || null; this.is_initial_draw_ = true; @@ -176,11 +176,11 @@ Dygraph.prototype.init_ = function(div, file, opt_attrs) { // rules _except_ for an explicit 'width' or 'height' on the div. // As an added convenience, if the div has zero height (like
does // without any styles), then we use a default height/width. - if (div.style.width === '' && attrs.width) { - div.style.width = attrs.width + "px"; + if (div.style.width === '' && attrs['width']) { + div.style.width = attrs['width'] + "px"; } - if (div.style.height === '' && attrs.height) { - div.style.height = attrs.height + "px"; + if (div.style.height === '' && attrs['height']) { + div.style.height = attrs['height'] + "px"; } if (div.style.height === '' && div.clientHeight === 0) { div.style.height = DEFAULT_HEIGHT + "px"; @@ -191,12 +191,12 @@ Dygraph.prototype.init_ = function(div, file, opt_attrs) { // These will be zero if the dygraph's div is hidden. In that case, // use the user-specified attributes if present. If not, use zero // and assume the user will call resize to fix things later. - this.width_ = div.clientWidth || attrs.width || 0; - this.height_ = div.clientHeight || attrs.height || 0; + this.width_ = div.clientWidth || attrs['width'] || 0; + this.height_ = div.clientHeight || attrs['height'] || 0; // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_. - if (attrs.stackedGraph) { - attrs.fillGraph = true; + if (attrs['stackedGraph']) { + attrs['fillGraph'] = true; // TODO(nikhilk): Add any other stackedGraph checks here. } @@ -3378,9 +3378,9 @@ Dygraph.prototype.updateOptions = function(input_attrs, opt_blockRedraw) { this.rollPeriod_ = attrs.rollPeriod; } if ('dateWindow' in attrs) { - this.dateWindow_ = attrs.dateWindow; + this.dateWindow_ = attrs['dateWindow']; if (!('isZoomedIgnoreProgrammaticZoom' in attrs)) { - this.zoomed_x_ = (attrs.dateWindow !== null); + this.zoomed_x_ = (attrs['dateWindow'] !== null); } } if ('valueRange' in attrs && !('isZoomedIgnoreProgrammaticZoom' in attrs)) {