Permalink
Browse files

ajax constructor fixed for ie5.5 and 6

  • Loading branch information...
1 parent 1831dbc commit 105dcdbb82838fbecff26e851217123663ba9507 @substack committed Aug 20, 2011
Showing with 15 additions and 18 deletions.
  1. +14 −17 index.js
  2. +1 −1 lib/request.js
View
@@ -33,23 +33,20 @@ var xhrHttp = (function () {
'Microsoft.XMLHTTP'
];
for (var i = 0; i < axs.length; i++) {
- var res = (function (j) {
- try {
- var ax = new(window.ActiveXObject)(axs[j]);
- return function () {
- if (ax) {
- var ax_ = ax;
- ax = null;
- return ax_;
- }
- else {
- return new(window.ActiveXObject)(axs[j]);
- }
- };
- }
- catch (e) {}
- })(i);
- if (res) return res;
+ try {
+ var ax = new(window.ActiveXObject)(axs[i]);
+ return function () {
+ if (ax) {
+ var ax_ = ax;
+ ax = null;
+ return ax_;
+ }
+ else {
+ return new(window.ActiveXObject)(axs[i]);
+ }
+ };
+ }
+ catch (e) {}
}
throw new Error('ajax not supported in this browser')
}
View
@@ -28,7 +28,7 @@ var Request = module.exports = function (xhr, params) {
});
xhr.onreadystatechange = function () {
- res.handle(this);
+ res.handle(xhr);
};
};

0 comments on commit 105dcdb

Please sign in to comment.