From 79c5c9f95ec9dc8be8a4104bb069cd9c74ef0486 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 7 Aug 2018 12:58:04 -0500 Subject: [PATCH] Add isnan() function for IE --- srcjs/output_binding_image.js | 2 +- srcjs/utils.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/srcjs/output_binding_image.js b/srcjs/output_binding_image.js index 9f35bf557..cf3c94c9d 100644 --- a/srcjs/output_binding_image.js +++ b/srcjs/output_binding_image.js @@ -1132,7 +1132,7 @@ imageutils.createBrush = function($el, opts, coordmap, expandPixels) { const bounds_data = boundsData(); // Check to see if we have valid boundsData for (let val in bounds_data) { - if (Number.isNaN(bounds_data[val])) return; + if (isnan(bounds_data[val])) return; } boundsData(bounds_data); diff --git a/srcjs/utils.js b/srcjs/utils.js index aa58c9ccb..6bffb52c0 100644 --- a/srcjs/utils.js +++ b/srcjs/utils.js @@ -254,6 +254,12 @@ function mapValues(obj, f) { return newObj; } +// This is does the same as Number.isNaN, but that function unfortunately does +// not exist in any version of IE. +function isnan(x) { + return typeof(x) === 'number' && isNaN(x); +} + // Binary equality function used by the equal function. function _equal(x, y) { if ($.type(x) === "object" && $.type(y) === "object") {