From c01215c3d48ebb9f9f1059f26efa0c0c9092da2b Mon Sep 17 00:00:00 2001 From: Steve Schwartz Date: Mon, 12 Sep 2011 22:37:29 -0400 Subject: [PATCH 001/199] Added jquery 1.6.4 to test suite --- test/server.rb | 2 +- test/views/layout.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/server.rb b/test/server.rb index a0a71873..d33cbc57 100644 --- a/test/server.rb +++ b/test/server.rb @@ -1,7 +1,7 @@ require 'sinatra' require 'json' -JQUERY_VERSIONS = %w[ 1.6 1.6.1 1.6.2 1.6.3 ].freeze +JQUERY_VERSIONS = %w[ 1.6 1.6.1 1.6.2 1.6.3 1.6.4 ].freeze use Rack::Static, :urls => ["/src"], :root => File.expand_path('..', settings.root) diff --git a/test/views/layout.erb b/test/views/layout.erb index ec9a7540..28041d92 100644 --- a/test/views/layout.erb +++ b/test/views/layout.erb @@ -8,7 +8,7 @@ color: #8699A4; text-align: right; font-family: sans-serif; line-height: 1; margin-top: -1.8em; padding: 0 2em .8em 0; } - #jquery-cdn { margin-right: 300px; } + #jquery-cdn { margin-right: 375px; } #jquery-cdn a, #jquery-version a { color: white; text-decoration: underline; } From 44df81adbb31b83f77ec59b4e616a4183861688e Mon Sep 17 00:00:00 2001 From: Steve Schwartz Date: Thu, 15 Sep 2011 12:06:27 -0400 Subject: [PATCH 002/199] Updated formInputClickSelector for button[type] IE7 issue. Closes #206. --- src/rails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rails.js b/src/rails.js index 67d4f58d..40223c0b 100644 --- a/src/rails.js +++ b/src/rails.js @@ -58,7 +58,7 @@ formSubmitSelector: 'form', // Form input elements bound by jquery-ujs - formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])', + formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not(button[type])', // Form input elements disabled during form submission disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]', From 888be8adcb7d609f442b3883dc722c5427e49354 Mon Sep 17 00:00:00 2001 From: Steve Schwartz Date: Mon, 3 Oct 2011 00:25:55 -0400 Subject: [PATCH 003/199] Carry over target attribute for a[data-method] links to form. Closes --- src/rails.js | 3 +++ test/public/test/data-method.js | 23 +++++++++++++++++------ test/public/test/settings.js | 5 +++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/rails.js b/src/rails.js index 40223c0b..6ef7f777 100644 --- a/src/rails.js +++ b/src/rails.js @@ -159,6 +159,7 @@ handleMethod: function(link) { var href = link.attr('href'), method = link.data('method'), + target = link.attr('target'), csrf_token = $('meta[name=csrf-token]').attr('content'), csrf_param = $('meta[name=csrf-param]').attr('content'), form = $('
'), @@ -168,6 +169,8 @@ metadata_input += ''; } + if (target) { form.attr('target', target); } + form.hide().append(metadata_input).appendTo('body'); form.submit(); }, diff --git a/test/public/test/data-method.js b/test/public/test/data-method.js index 34c282e0..ef50500f 100644 --- a/test/public/test/data-method.js +++ b/test/public/test/data-method.js @@ -1,11 +1,15 @@ (function(){ -module('data-method'); +module('data-method', { + setup: function() { + $('#qunit-fixture').append($('', { + href: '/echo', 'data-method': 'delete', text: 'destroy!' + })); + } +}); -function submit(fn) { - $('#qunit-fixture'). - append($('', { href: '/echo', 'data-method': 'delete', text: 'destroy!' })) - .find('a') +function submit(fn, options) { + $('#qunit-fixture').find('a') .bind('iframe:loaded', function(e, data) { fn(data); start(); @@ -31,4 +35,11 @@ asyncTest('link with "data-method" and CSRF', 1, function() { }); }); -})(); \ No newline at end of file +asyncTest('link "target" should be carried over to generated form', 1, function() { + $('a[data-method]').attr('target', 'super-special-frame'); + submit(function(data) { + equal(data.params._target, 'super-special-frame'); + }); +}); + +})(); diff --git a/test/public/test/settings.js b/test/public/test/settings.js index c58734d7..e23bf7ed 100644 --- a/test/public/test/settings.js +++ b/test/public/test/settings.js @@ -26,10 +26,11 @@ $(document).bind('submit', function(e) { if (!e.isDefaultPrevented()) { var form = $(e.target), action = form.attr('action'), name = 'form-frame' + jQuery.guid++, - iframe = $('