diff --git a/src/rails.js b/src/rails.js
index 7eee3906..c8eaafac 100644
--- a/src/rails.js
+++ b/src/rails.js
@@ -24,7 +24,7 @@
$.rails = rails = {
// Link elements bound by jquery-ujs
- linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
+ linkClickSelector: 'a[data-confirm], a[data-method]:not([disabled]), a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
// Button elements bound by jquery-ujs
buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)',
diff --git a/test/public/test/data-method.js b/test/public/test/data-method.js
index 32b90d70..a3f3657f 100644
--- a/test/public/test/data-method.js
+++ b/test/public/test/data-method.js
@@ -2,9 +2,16 @@
module('data-method', {
setup: function() {
- $('#qunit-fixture').append($('', {
- href: '/echo', 'data-method': 'delete', text: 'destroy!'
- }));
+ $('#qunit-fixture')
+ .append($('', {
+ href: '/echo', 'data-method': 'delete', text: 'destroy!'
+ }))
+ .append($('', {
+ href: '/echo',
+ 'data-method': 'post',
+ 'disabled': 'disabled',
+ text: 'Disabled link'
+ }));
},
teardown: function() {
$(document).off('iframe:loaded');
@@ -72,4 +79,17 @@ asyncTest('link with "data-method" and cross origin', 1, function() {
notEqual(data.authenticity_token, 'cf50faa3fe97702ca1ae');
});
+asyncTest('clicking on a link with disabled attribute', 0, function() {
+ $('a[disabled]')
+ .on("ajax:before", function(e, data, status, xhr) {
+ App.assertCallbackNotInvoked('ajax:success')
+ })
+ .on('ajax:complete', function() { start() })
+ .trigger('click')
+
+ setTimeout(function() {
+ start();
+ }, 13);
+});
+
})();
diff --git a/test/public/test/data-remote.js b/test/public/test/data-remote.js
index 215d8217..c4cf682d 100644
--- a/test/public/test/data-remote.js
+++ b/test/public/test/data-remote.js
@@ -23,7 +23,7 @@ module('data-remote', {
href: '/echo',
'data-remote': 'true',
disabled: 'disabled',
- text: 'Disabed link'
+ text: 'Disabled link'
}))
.find('form').append($(''));