Skip to content

Commit

Permalink
Merge pull request jashkenas#2550 from jerryorr/master
Browse files Browse the repository at this point in the history
Update PATCH/xhr check so that IE9 works
  • Loading branch information
jashkenas committed May 21, 2013
2 parents f69f1e6 + 971173c commit 9be5f2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};
Expand All @@ -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',
Expand Down

0 comments on commit 9be5f2f

Please sign in to comment.