vendor/jquery-ujs/src/rails.js in ext_yarn-0.3.1 vs vendor/jquery-ujs/src/rails.js in ext_yarn-0.4.0
- old
+ new
@@ -1,6 +1,6 @@
-/* jshint node: true */
+(function($, undefined) {
/**
* Unobtrusive scripting adapter for jQuery
* https://github.com/rails/jquery-ujs
*
@@ -8,17 +8,14 @@
*
* Released under the MIT license
*
*/
-(function() {
- 'use strict';
-
- var jqueryUjsInit = function($, undefined) {
-
// Cut down on the number of issues from people inadvertently including jquery_ujs twice
// by detecting and raising an error when it happens.
+ 'use strict';
+
if ( $.rails !== undefined ) {
$.error('jquery-ujs has already been loaded!');
}
// Shorthand to make it a little easier to call public rails functions from within rails.js
@@ -553,13 +550,6 @@
$(function(){
rails.refreshCSRFTokens();
});
}
- };
-
- if (window.jQuery) {
- jqueryUjsInit(jQuery);
- } else if (typeof exports === 'object' && typeof module === 'object') {
- module.exports = jqueryUjsInit;
- }
-})();
+})( jQuery );