Skip to content

Commit

Permalink
Updated jquery-ujs to add cross-domain request fix to exclude CSRF he…
Browse files Browse the repository at this point in the history
…ader insertion.
  • Loading branch information
JangoSteve committed Jun 15, 2011
1 parent 671826b commit c7da6fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/jquery/rails/version.rb
Expand Up @@ -3,6 +3,6 @@ module Rails
VERSION = "1.0.10"
JQUERY_VERSION = "1.6.1"
JQUERY_UI_VERSION = "1.8.12"
JQUERY_UJS_VERSION = "3c360e34fac79a951108842529f6a48f287734f5"
JQUERY_UJS_VERSION = "616e4fe354ce0ae5137636f9b5475782a7c9e896"
end
end
7 changes: 4 additions & 3 deletions vendor/assets/javascripts/jquery_ujs.js
Expand Up @@ -95,6 +95,7 @@
// Submits "remote" forms and links with ajax
handleRemote: function(element) {
var method, url, data,
crossDomain = element.data('cross-domain') || null,
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);

if (rails.fire(element, 'ajax:before')) {
Expand All @@ -116,7 +117,7 @@
}

rails.ajax({
url: url, type: method || 'GET', data: data, dataType: dataType,
url: url, type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
// stopping the "ajax:beforeSend" event will cancel the ajax request
beforeSend: function(xhr, settings) {
if (settings.dataType === undefined) {
Expand Down Expand Up @@ -244,9 +245,9 @@

// ajaxPrefilter is a jQuery 1.5 feature
if ('ajaxPrefilter' in $) {
$.ajaxPrefilter(function(options, originalOptions, xhr){ rails.CSRFProtection(xhr); });
$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
} else {
$(document).ajaxSend(function(e, xhr){ rails.CSRFProtection(xhr); });
$(document).ajaxSend(function(e, xhr, options){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
}

$(rails.linkClickSelector).live('click.rails', function(e) {
Expand Down

0 comments on commit c7da6fe

Please sign in to comment.