diff --git a/backbone.js b/backbone.js index 7333a278d..fe928e851 100644 --- a/backbone.js +++ b/backbone.js @@ -1176,8 +1176,7 @@ // If we're sending a `PATCH` request, and we're in an old Internet Explorer // that still has ActiveX enabled by default, override jQuery to use that // for XHR instead. Remove this line when jQuery supports `PATCH` on IE8. - if (params.type === 'PATCH' && window.ActiveXObject && - !(window.external && window.external.msActiveXFilteringEnabled)) { + if (params.type === 'PATCH' && noXhrPatch) { params.xhr = function() { return new ActiveXObject("Microsoft.XMLHTTP"); }; @@ -1189,6 +1188,8 @@ return xhr; }; + var noXhrPatch = typeof window !== 'undefined' && !!window.ActiveXObject && !(window.XMLHttpRequest && (new XMLHttpRequest).dispatchEvent); + // Map from CRUD to HTTP for our default `Backbone.sync` implementation. var methodMap = { 'create': 'POST',