From 9a1aeb96b6bcdba1b506fc07504a9cf282dc270b Mon Sep 17 00:00:00 2001 From: Harry Sarson Date: Thu, 27 Aug 2020 20:56:08 +0100 Subject: [PATCH 1/2] correctly compare bytes in == --- src/Elm/Kernel/Utils.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Elm/Kernel/Utils.js b/src/Elm/Kernel/Utils.js index 951dff4b..b5b655ed 100644 --- a/src/Elm/Kernel/Utils.js +++ b/src/Elm/Kernel/Utils.js @@ -63,6 +63,20 @@ function _Utils_eqHelp(x, y, depth, stack) y = __Dict_toList(y); } //*/ + + if (typeof DataView === "function" && x instanceof DataView) { + let length = x.byteLength; + + if (y.byteLength !== length) { + return false; + } + + for (let i = 0; i < length; ++i) { + if (x.getUint8(i) !== y.getUint8(i)) { + return false; + } + } + } for (var key in x) { From 949e1203bff8460cf60bae9a59614c43570a405b Mon Sep 17 00:00:00 2001 From: Harry Sarson Date: Wed, 6 Jan 2021 21:06:36 +0000 Subject: [PATCH 2/2] use ie safe var instead of let --- src/Elm/Kernel/Utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Elm/Kernel/Utils.js b/src/Elm/Kernel/Utils.js index b5b655ed..c7766c59 100644 --- a/src/Elm/Kernel/Utils.js +++ b/src/Elm/Kernel/Utils.js @@ -63,15 +63,15 @@ function _Utils_eqHelp(x, y, depth, stack) y = __Dict_toList(y); } //*/ - + if (typeof DataView === "function" && x instanceof DataView) { - let length = x.byteLength; - + var length = x.byteLength; + if (y.byteLength !== length) { return false; } - for (let i = 0; i < length; ++i) { + for (var i = 0; i < length; ++i) { if (x.getUint8(i) !== y.getUint8(i)) { return false; }