jquery-rails 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function($, undefined) {
1
+ /* jshint node: true */
2
2
 
3
3
  /**
4
4
  * Unobtrusive scripting adapter for jQuery
@@ -10,10 +10,13 @@
10
10
  *
11
11
  */
12
12
 
13
- // Cut down on the number of issues from people inadvertently including jquery_ujs twice
14
- // by detecting and raising an error when it happens.
13
+ (function() {
15
14
  'use strict';
16
15
 
16
+ var jqueryUjsInit = function($, undefined) {
17
+
18
+ // Cut down on the number of issues from people inadvertently including jquery_ujs twice
19
+ // by detecting and raising an error when it happens.
17
20
  if ( $.rails !== undefined ) {
18
21
  $.error('jquery-ujs has already been loaded!');
19
22
  }
@@ -33,10 +36,10 @@
33
36
  inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
34
37
 
35
38
  // Form elements bound by jquery-ujs
36
- formSubmitSelector: 'form',
39
+ formSubmitSelector: 'form:not([data-turbo=true])',
37
40
 
38
41
  // Form input elements bound by jquery-ujs
39
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
42
+ formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
40
43
 
41
44
  // Form input elements disabled during form submission
42
45
  disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
@@ -372,7 +375,7 @@
372
375
  element.html(replacement);
373
376
  }
374
377
 
375
- element.bind('click.railsDisable', function(e) { // prevent further clicking
378
+ element.on('click.railsDisable', function(e) { // prevent further clicking
376
379
  return rails.stopEverything(e);
377
380
  });
378
381
  element.data('ujs:disabled', true);
@@ -384,7 +387,7 @@
384
387
  element.html(element.data('ujs:enable-with')); // set to old enabled state
385
388
  element.removeData('ujs:enable-with'); // clean up cache
386
389
  }
387
- element.unbind('click.railsDisable'); // enable element
390
+ element.off('click.railsDisable'); // enable element
388
391
  element.removeData('ujs:disabled');
389
392
  }
390
393
  };
@@ -552,4 +555,11 @@
552
555
  });
553
556
  }
554
557
 
555
- })( jQuery );
558
+ };
559
+
560
+ if (window.jQuery) {
561
+ jqueryUjsInit(jQuery);
562
+ } else if (typeof exports === 'object' && typeof module === 'object') {
563
+ module.exports = jqueryUjsInit;
564
+ }
565
+ })();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-23 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: 1.3.6
120
120
  requirements: []
121
- rubygems_version: 3.2.33
121
+ rubygems_version: 3.4.6
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Use jQuery with Rails 4+