Skip to content

Commit

Permalink
shortened the ajax factory down to not use a loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottjehl committed Jul 14, 2011
1 parent 625d77d commit 5194009
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion respond.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 6 additions & 15 deletions respond.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,12 @@
},
//define ajax obj
xmlHttp = (function() {
var xmlhttpmethod = false,
attempts = [
function(){ return new ActiveXObject("Microsoft.XMLHTTP") },
function(){ return new XMLHttpRequest() }
],
al = attempts.length;

while( al-- ){
try {
xmlhttpmethod = attempts[ al ]();
}
catch(e) {
continue;
}
break;
var xmlhttpmethod = false;
try {
xmlhttpmethod = XMLHttpRequest();
}
catch( e ){
xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
}
return function(){
return xmlhttpmethod;
Expand Down

0 comments on commit 5194009

Please sign in to comment.