Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #11 from fliptheweb/master

Replace string.prototype.trim to $.trim
  • Loading branch information...
commit 24d3a14a50d1dcc83ebd95918d12d658e311996d 2 parents 5036007 + c996744
@alassek alassek authored
Showing with 3 additions and 8 deletions.
  1. +3 −8 jquery.rest.js
View
11 jquery.rest.js
@@ -22,12 +22,7 @@
(function($){
- var _ajax = $.ajax, trim;
-
- // support JS < 1.8.1
- trim = String.prototype.trim || function () {
- return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
- }
+ var _ajax = $.ajax;
// Will only use method override if $.restSetup.useMethodOverride is set to true
// Change the values of this global object if your method parameter is different.
@@ -95,11 +90,11 @@
function get_headers(xhr) {
// trim the headers because IE likes to include the blank line between the headers
// and the content as part of the headers
- var headers = {}, stringHeaders = trim.call(xhr.getAllResponseHeaders());
+ var headers = {}, stringHeaders = $.trim(xhr.getAllResponseHeaders());
$.each(stringHeaders.split("\n"), function (i, header) {
if (header.length) {
var matches = header.match(/^([\w\-]+):(.*)/);
- if (matches.length === 3) headers[ matches[1] ] = trim.call(matches[2]);
+ if (matches.length === 3) headers[ matches[1] ] = $.trim(matches[2]);
}
});
xhr.responseHeaders = headers;

0 comments on commit 24d3a14

Please sign in to comment.
Something went wrong with that request. Please try again.