Skip to content

Commit

Permalink
Merge pull request #263 from jaysoo/master
Browse files Browse the repository at this point in the history
jsdom support for text plugin, moves node test before browser test
  • Loading branch information
jrburke committed May 12, 2012
2 parents 07de481 + 5463c8f commit 6b50369
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions text.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,7 @@
}
};

if (text.createXhr()) {
text.get = function (url, callback) {
var xhr = text.createXhr();
xhr.open('GET', url, true);
xhr.onreadystatechange = function (evt) {
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
callback(xhr.responseText);
}
};
xhr.send(null);
};
} else if (typeof process !== "undefined" &&
if (typeof process !== "undefined" &&
process.versions &&
!!process.versions.node) {
//Using special require.nodeRequire, something added by r.js.
Expand All @@ -237,6 +224,19 @@
}
callback(file);
};
} else if (text.createXhr()) {
text.get = function (url, callback) {
var xhr = text.createXhr();
xhr.open('GET', url, true);
xhr.onreadystatechange = function (evt) {
//Do not explicitly handle errors, those should be
//visible via console output in the browser.
if (xhr.readyState === 4) {
callback(xhr.responseText);
}
};
xhr.send(null);
};
} else if (typeof Packages !== 'undefined') {
//Why Java, why is this so awkward?
text.get = function (url, callback) {
Expand Down

0 comments on commit 6b50369

Please sign in to comment.