vanilla-ujs 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7dbcec9a5433cfc808e5c1cd1cd162ec531978d
4
- data.tar.gz: a955726d6b2fd87b043ed29e545d99139920b575
3
+ metadata.gz: 3efdcdcb42fc9931f74e5b9887e4ddbc2ab8d4f2
4
+ data.tar.gz: 60c452e88b54a83c33abae028822cdc11e73075c
5
5
  SHA512:
6
- metadata.gz: 479e52886abc52b6ac13ab5b6dec1d3d7569c1c763e83db5c138d210aa74edb498f609ccdb5a1d494672934fd2f6e7e5578e0923a99d46f5113560c6080edeab
7
- data.tar.gz: 652d234263eb499059d2bd7fcb96d19bef8893b2431572db4395b45e7961be751f2f35276c70840f3f0aa3c829991f5352c1f4cf7e9c2326cd13940d4333c535
6
+ metadata.gz: 1e059b66b63c1986ea2f685badfe4715d4c260819a4d40ede3e347fd65959edf2cd7d0ab4e50ed0e3b357adf4918db8c6f8f1ca6e4faba08e6a4777cc89b6713
7
+ data.tar.gz: 36f966f29b519e39022cca833da65b7cdb069ac28600bf495f18f21fd95402a529ecf0dc8d2e3e40eca74401b2e786761e06bc897e7e159bdc45e28eb830b09c
data/.gitignore CHANGED
@@ -8,4 +8,5 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /node_modules
11
+ /vendor/bundle
11
12
  /*.gem
@@ -26,8 +26,8 @@ module.exports = function (grunt) {
26
26
  src: [
27
27
  'lib/assets/javascripts/vanilla-ujs/polyfills.js',
28
28
  'lib/assets/javascripts/vanilla-ujs/liteajax.js',
29
- 'lib/assets/javascripts/vanilla-ujs/method.js',
30
29
  'lib/assets/javascripts/vanilla-ujs/confirm.js',
30
+ 'lib/assets/javascripts/vanilla-ujs/method.js',
31
31
  'lib/assets/javascripts/vanilla-ujs/disable.js',
32
32
  'lib/assets/javascripts/vanilla-ujs/csrf.js',
33
33
  'lib/assets/javascripts/vanilla-ujs/form.js',
@@ -1,8 +1,21 @@
1
1
  document.addEventListener('click', function (event) {
2
2
  var message, element;
3
3
 
4
+ // do not disable on right click. Work on left and middle click
5
+ if (event.which == 3) {
6
+ return;
7
+ }
8
+
4
9
  element = event.target;
5
10
 
11
+ // do not disable if the element is a submit button and its form has invalid input elements.
12
+ // since failed validations prevent the form from being submitted, we would lock the form permanently
13
+ // by disabling the submit button even though the form was never submitted
14
+
15
+ if(element.getAttribute("type") === "submit" && element.form.querySelector(":invalid") !== null) {
16
+ return;
17
+ }
18
+
6
19
  if (matches.call(element, 'a[data-disable-with], button[data-disable-with], input[data-disable-with]')) {
7
20
  message = element.getAttribute('data-disable-with');
8
21
  if(!!element.value){
@@ -1,5 +1,5 @@
1
1
  module Vanilla
2
2
  module Ujs
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-ujs",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Rails UJS in VanillaJS",
5
5
  "main": "lib/assets/javascripts/vanilla-ujs.js",
6
6
  "scripts": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanilla-ujs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Łukasz Jan Niemier
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-19 00:00:00.000000000 Z
13
+ date: 2016-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties