Skip to content

Commit 1171f36

Browse files
committed
Possible fix for #96 - ensured we could always send using jQuery when other projects had called $.noConflict(). Should be good to go now.
1 parent 775b021 commit 1171f36

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/swagger.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,16 @@ SwaggerHttp.prototype.isIE8 = function() {
12621262
};
12631263

12641264
/*
1265-
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic
1265+
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
1266+
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
1267+
* Since we are using closures here we need to alias it for internal use.
12661268
*/
1267-
var JQueryHttpClient = function(options) {}
1269+
var JQueryHttpClient = function(options) {
1270+
"use strict";
1271+
if(!jQuery){
1272+
var jQuery = window.jQuery;
1273+
}
1274+
}
12681275

12691276
JQueryHttpClient.prototype.execute = function(obj) {
12701277
var cb = obj.on;
@@ -1337,9 +1344,9 @@ JQueryHttpClient.prototype.execute = function(obj) {
13371344
else
13381345
return cb.response(out);
13391346
};
1340-
1341-
$.support.cors = true;
1342-
return $.ajax(obj);
1347+
1348+
jQuery.support.cors = true;
1349+
return jQuery.ajax(obj);
13431350
}
13441351

13451352
/*

0 commit comments

Comments
 (0)