From fc8b4db796de852d67ad9df9a007adab42775ec2 Mon Sep 17 00:00:00 2001 From: Larissa Smith Date: Thu, 17 Sep 2015 15:45:39 -0600 Subject: [PATCH] Fix for Chrome (v 45) issue that key is sometimes undefined outside of the for-in loop. --- src/openseadragon.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index e651f8f9..6b36327b 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -805,10 +805,12 @@ if (typeof define === 'function' && define.amd) { // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. - var key; - for ( key in obj ) {} + var lastKey; + for (var key in obj ) { + lastKey = key; + } - return key === undefined || hasOwn.call( obj, key ); + return lastKey === undefined || hasOwn.call( obj, lastKey ); };