diff --git a/src/rails.js b/src/rails.js
index 39cf9158..94fda15e 100644
--- a/src/rails.js
+++ b/src/rails.js
@@ -22,7 +22,7 @@
$.rails = rails = {
// Link elements bound by jquery-ujs
- linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with], a[data-disable]',
+ linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
// Button elements bound by jquery-ujs
buttonClickSelector: 'button[data-remote]:not(form button), button[data-confirm]:not(form button)',
diff --git a/test/public/test/data-remote.js b/test/public/test/data-remote.js
index f8c6b2a8..f678f0bb 100644
--- a/test/public/test/data-remote.js
+++ b/test/public/test/data-remote.js
@@ -18,6 +18,12 @@ module('data-remote', {
'data-remote': 'true',
method: 'post'
}))
+ .append($('', {
+ href: '/echo',
+ 'data-remote': 'true',
+ disabled: 'disabled',
+ text: 'Disabed link'
+ }))
.find('form').append($(''));
}
@@ -84,6 +90,19 @@ asyncTest('clicking on a link with data-remote attribute', 5, function() {
.trigger('click');
});
+asyncTest('clicking on a link with disabled attribute', 0, function() {
+ $('a[disabled]')
+ .bind("ajax:before", function(e, data, status, xhr) {
+ App.assertCallbackNotInvoked('ajax:success')
+ })
+ .bind('ajax:complete', function() { start() })
+ .trigger('click')
+
+ setTimeout(function() {
+ start();
+ }, 13);
+});
+
asyncTest('clicking on a button with data-remote attribute', 5, function() {
$('button[data-remote]')
.bind('ajax:success', function(e, data, status, xhr) {