This project is archived and is in readonly mode.
jquery-ujs rails.js doesn't work with jQuery 1.4.3
Reported by Simone Carletti | October 19th, 2010 @ 02:34 PM | in 3.1
There's a problem regarding the data-confirm attribute.
If you add the :confirm
option to a link, it is always
submitted regardless you confirm or not the dialog.
Comments and changes to this ticket
-
Jon Buda October 19th, 2010 @ 03:29 PM
Seeing this as well. I'm thinking it's due to the way 1.4.3 now handles the html data attributes.
-
Simone Carletti October 19th, 2010 @ 04:01 PM
Honestly, I would increase the priority.
If you upgrade to jQuery 1.4.3 and you use :confirm on a delete action, the record will be delete no matter if you click oncancel
... -
Neeraj Singh October 19th, 2010 @ 04:22 PM
- Importance changed from Low to High
Bumped up the priority.
Not sure why but two tests are failing for jquery 1.4.2 . Last time I checked in my code all the tests were passing. Oh well. First I am looking a fix for jquery 1.4.3 and then will fix the tests. Such is life :-)
-
Neeraj Singh October 19th, 2010 @ 05:19 PM
Update:
In jQuery 1.4.3 "returning false" does not mean that rest of live bindings will not be called.
http://jsbin.com/ehagi4/2/edit
http://jsbin.com/ehagi4/3/edit
I am trying to get a confirmation from jQuery team if that is intentional ( most likely it is) or if it is a bug.
In the meantime I would suggest not to upgrade to jQuery 1.4.3 least of which is because of rails.js. This feature of going through all live bindings potentially can break a lot of things in your app. :-)
-
Santiago Pastorino October 19th, 2010 @ 05:22 PM
- State changed from new to open
- Milestone set to 3.1
- Assigned user set to Santiago Pastorino
-
Neeraj Singh October 19th, 2010 @ 05:30 PM
- State changed from open to new
- Milestone cleared.
- Assigned user cleared.
Here is link to the email sent to jQuery core mailing list.
http://forum.jquery.com/topic/in-jquery-1-4-3-event-after-returning...
-
Santiago Pastorino October 19th, 2010 @ 08:12 PM
- State changed from new to open
- Milestone set to 3.1
- Assigned user set to Santiago Pastorino
-
Yuval Kordov October 19th, 2010 @ 10:08 PM
We've temporarily resolved this issue by replacing the live call with a delegate:
// $('a[data-confirm],input[data-confirm]').live('click', function () { ... $('body').delegate('a[data-confirm],input[data-confirm]','click', function(e) { ...
-
Yuval Kordov October 19th, 2010 @ 10:09 PM
Let's try that again:
// $('a[data-confirm],input[data-confirm]').live('click', function () { ... $('body').delegate('a[data-confirm],input[data-confirm]','click', function(e) { ... -
Yuval Kordov October 19th, 2010 @ 10:10 PM
I hate markdown.
// $('a[data-confirm],input[data-confirm]').live('click', function () { ... $('body').delegate('a[data-confirm],input[data-confirm]','click', function(e) { ...
-
Neeraj Singh October 19th, 2010 @ 10:50 PM
@Yuval That works.
I am still awaiting to hear from jQuery core team regarding official statement. As per http://jsbin.com/ehagi4/4/edit looks like using delegate works as jQuery 1.4.2 works with live with respect to not continuting with the call chain once 'return false' has been invoked.
delegate was introduced in jQuery 1.4.2. If rails.js starts using that then people will not be able to use jQuery 1.4.1.
I will wait for the official statement from jQuery team and then we will try to find a solution.
-
Matheus Cáceres November 6th, 2010 @ 04:05 AM
I use JQuery 1.4.3 and Jquery-ujs today and here that's ok.
Maybe issue its fixed. -
Neeraj Singh November 6th, 2010 @ 07:01 AM
- State changed from open to resolved
Closing this ticket since the issue is fixed.
-
Greg B November 17th, 2010 @ 05:15 PM
I'm still seeing this problem with 3.03, jquery 1.4.4, and the latest rails.js from https://github.com/rails/jquery-ujs/blob/master/src/rails.js.
http://bugs.jquery.com/ticket/7217 seems to be the relevant jquery bug but is fixed in 1.4.4.
-
Neeraj Singh November 17th, 2010 @ 09:08 PM
That is why in the current version of rail.js confirmation is bound to body and not to document. https://github.com/rails/jquery-ujs/blob/master/src/rails.js#L80
Can you describe what is the issue you are running into with rails.js ?
-
Greg B November 17th, 2010 @ 11:51 PM
I have a simple Delete link as follows
<%= link_to 'Destroy', @report, :confirm => 'Are you sure?', :method => :delete %>When I click on it, it gives me the confirmation pop-up and if I click "Cancel", it repeats the pop-up one more times and then still deletes the record and tries to show the deleted record (does a GET "report/:id" request)
-
Neeraj Singh November 18th, 2010 @ 12:17 AM
Just now I tested with
rails edge
jQuery 1.4.4
railsj.js current versionwhen I click on cacel nothing happens. There is no repetition.
I tested with FF, safari and chrome.
-
Greg B November 18th, 2010 @ 01:34 AM
Ok, I tried again using a skeletal app and everything works fine. I isolated the problem to trying to use ujs with the jquery-colorbox plugin in my original app.
Sorry for the confusion
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>