From f2cba16a8b9bbbf6708e327f08c020d64be639b8 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Tue, 25 Jun 2013 14:12:29 -0400 Subject: [PATCH] Safe cleanup in makeAjaxRequest error handler Previously `request.onreadystatechange` was assigned an empty function on success but null on failures, which breaks in IE (see http://jsbin.com/ezozax/6/). This patch simply mimics the success behaviour in the cleanup function Closes #143 --- src/openseadragon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index b9de0bda..453e3e74 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1335,6 +1335,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ if ( options.async ) { /** @ignore */ request.onreadystatechange = function() { + // 4 = DONE (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties) if ( request.readyState == 4) { request.onreadystatechange = function(){}; options.success( request ); @@ -1352,7 +1353,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ e.message ); - request.onreadystatechange = null; + request.onreadystatechange = function(){}; request = null; if ( options.error && $.isFunction( options.error ) ) {