Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jQuery 1.4.3 fixed http://bugs.jquery.com/ticket/7217 because of which

returning false is not same as e.stopImmediatePropagation.

To get around this issues caused by jQuery 1.4.3, delegate is being used.
  • Loading branch information...
commit f991faf0074487b43a061168cdbfd102ee0c182c 1 parent d8541df
@neerajdotname neerajdotname authored josevalim committed
Showing with 22 additions and 8 deletions.
  1. +22 −8 src/rails.js
View
30 src/rails.js
@@ -60,14 +60,28 @@ jQuery(function ($) {
/**
* confirmation handler
*/
- $('a[data-confirm],input[data-confirm]').live('click', function () {
- var el = $(this);
- if (el.triggerAndReturn('confirm')) {
- if (!confirm(el.attr('data-confirm'))) {
- return false;
- }
- }
- });
+ var jqueryVersion = $().jquery;
+
+ if ( (jqueryVersion === '1.4') || (jqueryVersion === '1.4.1') || (jqueryVersion === '1.4.2')){
+ $('a[data-confirm],input[data-confirm]').live('click', function () {
+ var el = $(this);
+ if (el.triggerAndReturn('confirm')) {
+ if (!confirm(el.attr('data-confirm'))) {
+ return false;
+ }
+ }
+ });
+ } else {
+ $('body').delegate('a[data-confirm],input[data-confirm]', 'click', function () {
+ var el = $(this);
+ if (el.triggerAndReturn('confirm')) {
+ if (!confirm(el.attr('data-confirm'))) {
+ return false;
+ }
+ }
+ });
+ }
+
/**
Please sign in to comment.
Something went wrong with that request. Please try again.