jquery-rails 4.0.3 → 4.0.4
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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6950a11f58e399bdf4c52733598011f5f0306d31
|
4
|
+
data.tar.gz: 1aec4ab15af412138502b80fe7ae459fb007bd74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3161c3a359063d6568662266d6945e594f617584557d6faae1127a9a118d94811fed2a73cb0d2a8f70052772b91d12e987a009d8a969b631d11b2b166b5fcfc
|
7
|
+
data.tar.gz: 8c087eeed4d2bdb64905e60c6214e8827d74bf6a65fa02aba3c60653e5876a70adb3dcf8b1b735480ab1f96e6b06b5ec0a39d57a4faec2b03091154c9a4ce9b2
|
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: 4.0.
|
4
|
+
version: 4.0.4
|
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
|