@kevinburke/flot 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/flot.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @kevinburke/flot v5.0.0 | MIT License | https://github.com/kevinburke/flot */
1
+ /*! @kevinburke/flot v5.1.0 | MIT License | https://github.com/kevinburke/flot */
2
2
  var browser = {
3
3
  getPageXY: function (e) {
4
4
  var doc = document.documentElement,
@@ -19,7 +19,9 @@ var browser = {
19
19
  },
20
20
 
21
21
  isSafari: function() {
22
- return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.top['safari'] || (typeof window.top.safari !== 'undefined' && window.top.safari.pushNotification));
22
+ var top = window.top;
23
+ if (!top) return false;
24
+ return /constructor/i.test(top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!top['safari'] || (typeof top.safari !== 'undefined' && top.safari.pushNotification));
23
25
  },
24
26
 
25
27
  isMobileSafari: function() {
@@ -27,7 +29,7 @@ var browser = {
27
29
  },
28
30
 
29
31
  isOpera: function() {
30
- return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
32
+ return (!!window.opr && !!window.opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
31
33
  },
32
34
 
33
35
  isFirefox: function() {
@@ -345,7 +347,7 @@ var Canvas = function(cls, container) {
345
347
  // already been rendered, and remove those that are no longer active.
346
348
 
347
349
  for (var layerKey in cache) {
348
- if (hasOwnProperty.call(cache, layerKey)) {
350
+ if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
349
351
  var layer = this.getSVGLayer(layerKey),
350
352
  layerCache = cache[layerKey];
351
353
 
@@ -353,10 +355,10 @@ var Canvas = function(cls, container) {
353
355
  layer.style.display = 'none';
354
356
 
355
357
  for (var styleKey in layerCache) {
356
- if (hasOwnProperty.call(layerCache, styleKey)) {
358
+ if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
357
359
  var styleCache = layerCache[styleKey];
358
360
  for (var key in styleCache) {
359
- if (hasOwnProperty.call(styleCache, key)) {
361
+ if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
360
362
  var val = styleCache[key],
361
363
  positions = val.positions;
362
364
 
@@ -710,10 +712,10 @@ var Canvas = function(cls, container) {
710
712
  var layerCache = this._textCache[layer];
711
713
  if (layerCache != null) {
712
714
  for (var styleKey in layerCache) {
713
- if (hasOwnProperty.call(layerCache, styleKey)) {
715
+ if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
714
716
  var styleCache = layerCache[styleKey];
715
717
  for (var key in styleCache) {
716
- if (hasOwnProperty.call(styleCache, key)) {
718
+ if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
717
719
  var positions = styleCache[key].positions;
718
720
  positions.forEach(function(position) {
719
721
  position.active = false;
@@ -746,7 +748,7 @@ var Canvas = function(cls, container) {
746
748
  Canvas.prototype.clearCache = function() {
747
749
  var cache = this._textCache;
748
750
  for (var layerKey in cache) {
749
- if (hasOwnProperty.call(cache, layerKey)) {
751
+ if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
750
752
  var layer = this.getSVGLayer(layerKey);
751
753
  while (layer.firstChild) {
752
754
  layer.removeChild(layer.firstChild);
@@ -3575,6 +3577,8 @@ Licensed under the MIT license.
3575
3577
  markings = markings(axes);
3576
3578
  }
3577
3579
 
3580
+ if (!markings) return;
3581
+
3578
3582
  var i;
3579
3583
  for (i = 0; i < markings.length; ++i) {
3580
3584
  var m = markings[i],
@@ -4490,7 +4494,7 @@ Licensed under the MIT license.
4490
4494
  // Plugin registry. Plugins push to this array to register themselves.
4491
4495
  var plugins = [];
4492
4496
 
4493
- var version = "5.0.0";
4497
+ var version = "5.1.0";
4494
4498
 
4495
4499
  // The main plot function.
4496
4500
  function plot(placeholder, data, options) {
@@ -9212,7 +9216,7 @@ temporary images load their data.
9212
9216
 
9213
9217
  // Encode the string as UTF-8 and convert it to a binary string. The UTF-8 encoding is required to
9214
9218
  // capture unicode characters correctly.
9215
- utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)('utf-8').encode(source));
9219
+ utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)().encode(source));
9216
9220
 
9217
9221
  data = "data:image/svg+xml;base64," + btoa(utf8BinaryString);
9218
9222
  img.src = data;
@@ -1,4 +1,4 @@
1
- /*! @kevinburke/flot v5.0.0 | MIT License | https://github.com/kevinburke/flot */
1
+ /*! @kevinburke/flot v5.1.0 | MIT License | https://github.com/kevinburke/flot */
2
2
  (function ($) {
3
3
  'use strict';
4
4
 
@@ -22,7 +22,9 @@
22
22
  },
23
23
 
24
24
  isSafari: function() {
25
- return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.top['safari'] || (typeof window.top.safari !== 'undefined' && window.top.safari.pushNotification));
25
+ var top = window.top;
26
+ if (!top) return false;
27
+ return /constructor/i.test(top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!top['safari'] || (typeof top.safari !== 'undefined' && top.safari.pushNotification));
26
28
  },
27
29
 
28
30
  isMobileSafari: function() {
@@ -30,7 +32,7 @@
30
32
  },
31
33
 
32
34
  isOpera: function() {
33
- return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
35
+ return (!!window.opr && !!window.opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
34
36
  },
35
37
 
36
38
  isFirefox: function() {
@@ -348,7 +350,7 @@
348
350
  // already been rendered, and remove those that are no longer active.
349
351
 
350
352
  for (var layerKey in cache) {
351
- if (hasOwnProperty.call(cache, layerKey)) {
353
+ if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
352
354
  var layer = this.getSVGLayer(layerKey),
353
355
  layerCache = cache[layerKey];
354
356
 
@@ -356,10 +358,10 @@
356
358
  layer.style.display = 'none';
357
359
 
358
360
  for (var styleKey in layerCache) {
359
- if (hasOwnProperty.call(layerCache, styleKey)) {
361
+ if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
360
362
  var styleCache = layerCache[styleKey];
361
363
  for (var key in styleCache) {
362
- if (hasOwnProperty.call(styleCache, key)) {
364
+ if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
363
365
  var val = styleCache[key],
364
366
  positions = val.positions;
365
367
 
@@ -713,10 +715,10 @@
713
715
  var layerCache = this._textCache[layer];
714
716
  if (layerCache != null) {
715
717
  for (var styleKey in layerCache) {
716
- if (hasOwnProperty.call(layerCache, styleKey)) {
718
+ if (Object.prototype.hasOwnProperty.call(layerCache, styleKey)) {
717
719
  var styleCache = layerCache[styleKey];
718
720
  for (var key in styleCache) {
719
- if (hasOwnProperty.call(styleCache, key)) {
721
+ if (Object.prototype.hasOwnProperty.call(styleCache, key)) {
720
722
  var positions = styleCache[key].positions;
721
723
  positions.forEach(function(position) {
722
724
  position.active = false;
@@ -749,7 +751,7 @@
749
751
  Canvas.prototype.clearCache = function() {
750
752
  var cache = this._textCache;
751
753
  for (var layerKey in cache) {
752
- if (hasOwnProperty.call(cache, layerKey)) {
754
+ if (Object.prototype.hasOwnProperty.call(cache, layerKey)) {
753
755
  var layer = this.getSVGLayer(layerKey);
754
756
  while (layer.firstChild) {
755
757
  layer.removeChild(layer.firstChild);
@@ -3578,6 +3580,8 @@
3578
3580
  markings = markings(axes);
3579
3581
  }
3580
3582
 
3583
+ if (!markings) return;
3584
+
3581
3585
  var i;
3582
3586
  for (i = 0; i < markings.length; ++i) {
3583
3587
  var m = markings[i],
@@ -4493,7 +4497,7 @@
4493
4497
  // Plugin registry. Plugins push to this array to register themselves.
4494
4498
  var plugins = [];
4495
4499
 
4496
- var version = "5.0.0";
4500
+ var version = "5.1.0";
4497
4501
 
4498
4502
  // The main plot function.
4499
4503
  function plot(placeholder, data, options) {
@@ -9215,7 +9219,7 @@
9215
9219
 
9216
9220
  // Encode the string as UTF-8 and convert it to a binary string. The UTF-8 encoding is required to
9217
9221
  // capture unicode characters correctly.
9218
- utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)('utf-8').encode(source));
9222
+ utf8BinaryString = buildBinaryString(new (TextEncoder || TextEncoderLite)().encode(source));
9219
9223
 
9220
9224
  data = "data:image/svg+xml;base64," + btoa(utf8BinaryString);
9221
9225
  img.src = data;