jquery-rails 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSIONS.md +1 -0
- data/lib/jquery/rails/version.rb +2 -2
- data/vendor/assets/javascripts/jquery_ujs.js +25 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2fb7c1bc54c76ac75d4d6ba5aa8a4180e635ce9
|
4
|
+
data.tar.gz: 8d546a3a4f7dac4337f9d70abd7b339f15a3bfd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30921a1b02aabac4035a959719a62fe48283331124baca8fc78961ec0266903e88e935fd570e57c6cf27d7fb46328a6676fd4f6c6b70ae53bc1f8af2889c2df0
|
7
|
+
data.tar.gz: c21818f07a70497e53f48e6024d5d008ecdac28e276401f7743b0afcb6609803bb52f53f0c5a3b9a01c754adc0759a808e92fc4ef27b7ed1d17e95f026e9f120
|
data/CHANGELOG.md
CHANGED
data/VERSIONS.md
CHANGED
data/lib/jquery/rails/version.rb
CHANGED
@@ -86,16 +86,14 @@
|
|
86
86
|
|
87
87
|
// Default way to get an element's href. May be overridden at $.rails.href.
|
88
88
|
href: function(element) {
|
89
|
-
return element.
|
89
|
+
return element[0].href;
|
90
90
|
},
|
91
91
|
|
92
92
|
// Submits "remote" forms and links with ajax
|
93
93
|
handleRemote: function(element) {
|
94
|
-
var method, url, data,
|
94
|
+
var method, url, data, withCredentials, dataType, options;
|
95
95
|
|
96
96
|
if (rails.fire(element, 'ajax:before')) {
|
97
|
-
elCrossDomain = element.data('cross-domain');
|
98
|
-
crossDomain = elCrossDomain === undefined ? null : elCrossDomain;
|
99
97
|
withCredentials = element.data('with-credentials') || null;
|
100
98
|
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
101
99
|
|
@@ -147,7 +145,7 @@
|
|
147
145
|
error: function(xhr, status, error) {
|
148
146
|
element.trigger('ajax:error', [xhr, status, error]);
|
149
147
|
},
|
150
|
-
crossDomain:
|
148
|
+
crossDomain: rails.isCrossDomain(url)
|
151
149
|
};
|
152
150
|
|
153
151
|
// There is no withCredentials for IE6-8 when
|
@@ -167,6 +165,27 @@
|
|
167
165
|
}
|
168
166
|
},
|
169
167
|
|
168
|
+
// Determines if the request is a cross domain request.
|
169
|
+
isCrossDomain: function(url) {
|
170
|
+
var originAnchor = document.createElement("a");
|
171
|
+
originAnchor.href = location.href;
|
172
|
+
var urlAnchor = document.createElement("a");
|
173
|
+
|
174
|
+
try {
|
175
|
+
urlAnchor.href = url;
|
176
|
+
// This is a workaround to a IE bug.
|
177
|
+
urlAnchor.href = urlAnchor.href;
|
178
|
+
|
179
|
+
// Make sure that the browser parses the URL and that the protocols and hosts match.
|
180
|
+
return !urlAnchor.protocol || !urlAnchor.host ||
|
181
|
+
(originAnchor.protocol + "//" + originAnchor.host !==
|
182
|
+
urlAnchor.protocol + "//" + urlAnchor.host);
|
183
|
+
} catch (e) {
|
184
|
+
// If there is an error parsing the URL, assume it is crossDomain.
|
185
|
+
return true;
|
186
|
+
}
|
187
|
+
},
|
188
|
+
|
170
189
|
// Handles "data-method" on links such as:
|
171
190
|
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
172
191
|
handleMethod: function(link) {
|
@@ -178,7 +197,7 @@
|
|
178
197
|
form = $('<form method="post" action="' + href + '"></form>'),
|
179
198
|
metadataInput = '<input name="_method" value="' + method + '" type="hidden" />';
|
180
199
|
|
181
|
-
if (csrfParam !== undefined && csrfToken !== undefined) {
|
200
|
+
if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {
|
182
201
|
metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />';
|
183
202
|
}
|
184
203
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Arko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: 1.3.6
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project: jquery-rails
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.4.5
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Use jQuery with Rails 3+
|