Skip to content

Commit

Permalink
* master branch is dropping the support for jquery 1.4, 1.4.1 and 1.4…
Browse files Browse the repository at this point in the history
….2 .

* If you are using one of those versions then use branch v1.4 .
* All test files have been updated to reflect the same .
  • Loading branch information
Neeraj Singh committed Nov 12, 2010
1 parent e5b2f83 commit e076121
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
15 changes: 11 additions & 4 deletions README.rdoc
Expand Up @@ -2,12 +2,19 @@

Unobtrusive jQuery with Rails 3

== Following versions of jQuery are supported:
== The rails.js file from master branch supports following versions of jQuery:

* 1.4.3
* 1.4.4

== If you are using one of the following version of jQuery then use branch v1.4 .

* 1.4
* 1.4.1
* 1.4.2
* 1.4.3

rails.js file from v1.4 branch can be accessed at https://github.com/rails/jquery-ujs/blob/v1.4/src/rails.js .


== Automated Installation

Expand All @@ -30,7 +37,7 @@ Run this command:

Download jQuery from http://docs.jquery.com/Downloading_jQuery and put the file in public/javascripts. For example, the file might look like:

public/javascripts/jquery-1.4.3.min.js
public/javascripts/jquery-1.4.4.min.js

=== Step 2

Expand All @@ -55,4 +62,4 @@ Switch the <tt>javascript_include_tag :defaults</tt> to use jquery instead of th

Visit http://localhost:4567 and all the tests should pass.

At the top of the page you will see links to jQuery 1.4.1, 1.4.2 and 1.4.3 . By clicking on those links you will be executing the tests against the clicked version of jquery. By default test uses jQuery 1.4.3 .
At the top of the page you will see links to jQuery 1.4.3 and 1.4.4 . By clicking on those links you will be executing the tests against the clicked version of jquery. By default test uses jQuery 1.4.4 .
31 changes: 10 additions & 21 deletions src/rails.js
Expand Up @@ -3,7 +3,7 @@
*
* http://github.com/rails/jquery-ujs/blob/master/src/rails.js
*
* This rails.js file supports jQuery 1.4, 1.4.1, 1.4.2 and 1.4.3 .
* This rails.js file supports jQuery 1.4.3 and 1.4.4 .
*
*/

Expand Down Expand Up @@ -78,26 +78,15 @@ jQuery(function ($) {
*/
var jqueryVersion = $().jquery;

if ( (jqueryVersion === '1.4') || (jqueryVersion === '1.4.1') || (jqueryVersion === '1.4.2')){
$('a[data-confirm], button[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], button[data-confirm], input[data-confirm]', 'click', function () {
var el = $(this);
if (el.triggerAndReturn('confirm')) {
if (!confirm(el.attr('data-confirm'))) {
return false;
}
}
});
}

$('body').delegate('a[data-confirm], button[data-confirm], input[data-confirm]', 'click', function () {
var el = $(this);
if (el.triggerAndReturn('confirm')) {
if (!confirm(el.attr('data-confirm'))) {
return false;
}
}
});



/**
Expand Down
2 changes: 1 addition & 1 deletion test/server.rb
Expand Up @@ -15,7 +15,7 @@

get '/' do
FileUtils.cp(source_file, dest_file)
params[:version] ||= '1.4.3'
params[:version] ||= '1.4.4'
erb :index
end

Expand Down
3 changes: 1 addition & 2 deletions test/views/index.erb
Expand Up @@ -23,9 +23,8 @@
<body id="body">
<h1 id="qunit-header">
jquery-ujs test
<%= jquery_link '1.4.1' %>
<%= jquery_link '1.4.2' %>
<%= jquery_link '1.4.3' %>
<%= jquery_link '1.4.4' %>
</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
Expand Down

0 comments on commit e076121

Please sign in to comment.