Permalink
Browse files

Merge pull request #148 from 3rd-Eden/better-node-xhr

Don't check against the window to detect node.js, wrap code in a try cat...
  • Loading branch information...
2 parents 6878014 + 3c6eb2a commit b5c982cc19485b1fae177c1091f091e3c4c732bd @rauchg rauchg committed Mar 27, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/util.js
View
@@ -202,10 +202,10 @@ exports.ua.ios6 = exports.ua.ios && /OS 6_/.test(navigator.userAgent);
*/
exports.request = function request (xdomain) {
- if ('undefined' == typeof window) {
+ try {
var _XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
return new _XMLHttpRequest();
- }
+ } catch (e) {}
if (xdomain && 'undefined' != typeof XDomainRequest && !exports.ua.hasCORS) {
return new XDomainRequest();

0 comments on commit b5c982c

Please sign in to comment.