diff --git a/CHANGELOG b/CHANGELOG
index 529a412..8ea54d4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+* Fixed a variety of non-ASCII chars and similar [#610 state:resolved] (T.J. Crowder)
+
* Add Chrome 1+ to the list of supported browsers. (kangax)
* Fix `Template#evaluate` "eating" previous character if `null` was returned from `toTemplateReplacements` function. (Nir, Jürgen Hörmann, kangax)
diff --git a/src/ajax.js b/src/ajax.js
index 2771fd8..96cd928 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -1,18 +1,18 @@
/**
* == Ajax ==
- *
+ *
* Prototype's APIs around the `XmlHttpRequest` object.
- *
+ *
* The Prototype framework enables you to deal with Ajax calls in a manner that is
* both easy and compatible with all modern browsers.
- *
+ *
* Actual requests are made by creating instances of [[Ajax.Request]].
- *
+ *
*
Request headers
- *
+ *
* The following headers are sent with all Ajax requests (and can be
* overridden with the `requestHeaders` option described below):
- *
+ *
* * `X-Requested-With` is set to `XMLHttpRequest`.
* * `X-Prototype-Version` is set to Prototype's current version (e.g.,
* `1.6.0.3`).
@@ -20,18 +20,18 @@
* text/xml, * / *`
* * `Content-type` is automatically determined based on the `contentType`
* and `encoding` options.
- *
+ *
* Ajax options
- *
+ *
* All Ajax classes share a common set of _options_ and _callbacks_.
* Callbacks are called at various points in the life-cycle of a request, and
* always feature the same list of arguments.
- *
+ *
* Common options
- *
+ *
* * `asynchronous` ([[Boolean]]; default `true`): Determines whether
* `XMLHttpRequest` is used asynchronously or not. Synchronous usage is
- * seriously discouraged — it halts all script execution for the duration of
+ * seriously discouraged — it halts all script execution for the duration of
* the request _and_ blocks the browser UI.
* * `contentType` ([[String]]; default `application/x-www-form-urlencoded`):
* The `Content-type` header for your request. Change this header if you
@@ -63,16 +63,16 @@
* * `sanitizeJSON` ([[Boolean]]; default is `false` for same-origin requests,
* `true` otherwise): Sanitizes the contents of
* [[Ajax.Response#responseText]] before evaluating it.
- *
+ *
* Common callbacks
- *
+ *
* When used on individual instances, all callbacks (except `onException`) are
* invoked with two parameters: the `XMLHttpRequest` object and the result of
* evaluating the `X-JSON` response header, if any (can be `null`).
- *
+ *
* For another way of describing their chronological order and which callbacks
* are mutually exclusive, see [[Ajax.Request]].
- *
+ *
* * `onCreate`: Triggered when the [[Ajax.Request]] object is initialized.
* This is _after_ the parameters and the URL have been processed, but
* _before_ opening the connection via the XHR object.
@@ -102,9 +102,9 @@
* instance), and the second is the exception object.
* * `onComplete`: Triggered at the _very end_ of a request's life-cycle, after
* the request completes, status-specific callbacks are called, and possible
- * automatic behaviors are processed. Guaranteed to run regardless of what
+ * automatic behaviors are processed. Guaranteed to run regardless of what
* happened during the request.
- *
+ *
**/
//= require "ajax/ajax"
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index d8174f2..e8b831a 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -10,10 +10,10 @@ var Ajax = {
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
) || false;
},
-
+
/**
* Ajax.activeRequestCount -> Number
- *
+ *
* Represents the number of active XHR requests triggered through
* [[Ajax.Request]], [[Ajax.Updater]], or [[Ajax.PeriodicalUpdater]].
**/
diff --git a/src/ajax/base.js b/src/ajax/base.js
index 0be66bc..1862d07 100644
--- a/src/ajax/base.js
+++ b/src/ajax/base.js
@@ -11,10 +11,10 @@ Ajax.Base = Class.create({
evalJS: true
};
Object.extend(this.options, options || { });
-
+
this.options.method = this.options.method.toLowerCase();
-
- if (Object.isString(this.options.parameters))
+
+ if (Object.isString(this.options.parameters))
this.options.parameters = this.options.parameters.toQueryParams();
else if (Object.isHash(this.options.parameters))
this.options.parameters = this.options.parameters.toObject();
diff --git a/src/ajax/periodical_updater.js b/src/ajax/periodical_updater.js
index 51ddfe7..3214273 100644
--- a/src/ajax/periodical_updater.js
+++ b/src/ajax/periodical_updater.js
@@ -1,28 +1,28 @@
/** section: Ajax
* class Ajax.PeriodicalUpdater
- *
- * Periodically performs an Ajax request and updates a container’s contents
+ *
+ * Periodically performs an Ajax request and updates a container's contents
* based on the response text.
- *
+ *
* `Ajax.PeriodicalUpdater` behaves like [[Ajax.Updater]], but performs the
* update at a prescribed interval, rather than only once. (Note that it is
* _not_ a subclass of `Ajax.Updater`; it's a wrapper around it.)
- *
+ *
* This class addresses the common need of periodical update, as required by
- * all sorts of “polling” mechanisms (e.g., an online chatroom or an online
+ * all sorts of "polling" mechanisms (e.g., an online chatroom or an online
* mail client).
- *
+ *
* The basic idea is to run a regular [[Ajax.Updater]] at regular intervals,
* keeping track of the response text so it can (optionally) react to
* receiving the exact same response consecutively.
- *
+ *
* Additional options
- *
+ *
* `Ajax.PeriodicalUpdater` features all the common options and callbacks
- * described in the [[Ajax section]] — _plus_ those added by `Ajax.Updater`.
- *
+ * described in the [[Ajax section]] — _plus_ those added by `Ajax.Updater`.
+ *
* It also provides two new options:
- *
+ *
* * `frequency` ([[Number]]; default is `2`): How long, in seconds, to wait
* between the end of one request and the beginning of the next.
* * `decay` ([[Number]]; default is `1`): The rate at which the `frequency`
@@ -33,13 +33,13 @@
* (2 seconds, 4 seconds, 8 seconds...) each consecutive time the result
* is the same; when the result is different once again, `frequency` will
* revert to its original value.
- *
+ *
* Disabling and re-enabling a PeriodicalUpdater
- *
+ *
* You can hit the brakes on a running `PeriodicalUpdater` by calling
* [[Ajax.PeriodicalUpdater#stop]]. If you wish to re-enable it later, call
* [[Ajax.PeriodicalUpdater#start]].
- *
+ *
**/
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
@@ -54,7 +54,7 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
* `http`).
* - options (Object): Configuration for the request. See the
* [[Ajax section]] for more information.
- *
+ *
* Creates a new `Ajax.PeriodicalUpdater`.
**/
initialize: function($super, container, url, options) {
@@ -63,7 +63,7 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);
-
+
this.updater = { };
this.container = container;
this.url = url;
@@ -73,7 +73,7 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
/**
* Ajax.PeriodicalUpdater#start() -> undefined
- *
+ *
* Starts the periodical updater (if it had previously been stopped with
* [[Ajax.PeriodicalUpdater#stop]]).
**/
@@ -84,9 +84,9 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
/**
* Ajax.PeriodicalUpdater#stop() -> undefined
- *
+ *
* Stops the periodical updater.
- *
+ *
* Also calls the `onComplete` callback, if one has been defined.
**/
stop: function() {
@@ -97,7 +97,7 @@ Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
updateComplete: function(response) {
if (this.options.decay) {
- this.decay = (response.responseText == this.lastText ?
+ this.decay = (response.responseText == this.lastText ?
this.decay * this.options.decay : 1);
this.lastText = response.responseText;
diff --git a/src/ajax/request.js b/src/ajax/request.js
index b19d5f4..b79df17 100644
--- a/src/ajax/request.js
+++ b/src/ajax/request.js
@@ -1,22 +1,22 @@
/** section: Ajax
* class Ajax.Request
- *
+ *
* Initiates and processes an Ajax request.
- *
+ *
* `Ajax.Request` is a general-purpose class for making HTTP requests.
- *
+ *
* Automatic JavaScript response evaluation
- *
+ *
* If an Ajax request follows the _same-origin policy_ **and** its response
* has a JavaScript-related `Content-type`, the content of the `responseText`
* property will automatically be passed to `eval`.
- *
+ *
* In other words: you don't even need to provide a callback to leverage
* pure-JavaScript Ajax responses. This is the convention that drives Rails's
* RJS.
- *
+ *
* The list of JavaScript-related MIME-types handled by Prototype is:
- *
+ *
* * `application/ecmascript`
* * `application/javascript`
* * `application/x-ecmascript`
@@ -25,30 +25,30 @@
* * `text/javascript`
* * `text/x-ecmascript`
* * `text/x-javascript`
- *
+ *
* The MIME-type string is examined in a case-insensitive manner.
- *
+ *
* Methods you may find useful
- *
+ *
* Instances of the `Request` object provide several methods that can come in
* handy in your callback functions, especially once the request is complete.
- *
+ *
* Is the response a successful one?
- *
+ *
* The [[Ajax.Request#success]] method examines the XHR object's `status`
* property and follows general HTTP guidelines: unknown status is deemed
* successful, as is the whole `2xy` status code family. It's a generally
* better way of testing your response than the usual
* `200 == transport.status`.
- *
+ *
* Getting HTTP response headers
- *
+ *
* While you can obtain response headers from the XHR object using its
* `getResponseHeader` method, this makes for verbose code, and several
* implementations raise an exception when the header is not found. To make
* this easier, you can use the [[Ajax.Response#getHeader]] method, which
* delegates to the longer version and returns `null` if an exception occurs:
- *
+ *
* new Ajax.Request('/your/url', {
* onSuccess: function(response) {
* // Note how we brace against null values
@@ -57,16 +57,16 @@
* // Remainder of the code
* }
* });
- *
+ *
* Evaluating JSON headers
- *
+ *
* Some backends will return JSON not as response text, but in the `X-JSON`
* header. In this case, you don't even need to evaluate the returned JSON
* yourself, as Prototype automatically does so. It passes the result as the
* `headerJSON` property of the [[Ajax.Response]] object. Note that if there
- * is no such header — or its contents are invalid — `headerJSON` will be set
+ * is no such header — or its contents are invalid — `headerJSON` will be set
* to `null`.
- *
+ *
* new Ajax.Request('/your/url', {
* onSuccess: function(transport) {
* transport.headerJSON
@@ -75,7 +75,7 @@
**/
Ajax.Request = Class.create(Ajax.Base, {
_complete: false,
-
+
/**
* new Ajax.Request(url[, options])
* - url (String): The URL to fetch. When the _same-origin_ policy is in
@@ -84,7 +84,7 @@ Ajax.Request = Class.create(Ajax.Base, {
* `http`).
* - options (Object): Configuration for the request. See the
* [[Ajax section]] for more information.
- *
+ *
* Creates a new `Ajax.Request`.
**/
initialize: function($super, url, options) {
@@ -103,7 +103,7 @@ Ajax.Request = Class.create(Ajax.Base, {
params['_method'] = this.method;
this.method = 'post';
}
-
+
this.parameters = params;
if (params = Object.toQueryString(params)) {
@@ -113,17 +113,17 @@ Ajax.Request = Class.create(Ajax.Base, {
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params += '&_=';
}
-
+
try {
var response = new Ajax.Response(this);
if (this.options.onCreate) this.options.onCreate(response);
Ajax.Responders.dispatch('onCreate', this, response);
-
- this.transport.open(this.method.toUpperCase(), this.url,
+
+ this.transport.open(this.method.toUpperCase(), this.url,
this.options.asynchronous);
if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
-
+
this.transport.onreadystatechange = this.onStateChange.bind(this);
this.setRequestHeaders();
@@ -133,7 +133,7 @@ Ajax.Request = Class.create(Ajax.Base, {
/* Force Firefox to handle ready state 4 for synchronous requests */
if (!this.options.asynchronous && this.transport.overrideMimeType)
this.onStateChange();
-
+
}
catch (e) {
this.dispatchException(e);
@@ -145,7 +145,7 @@ Ajax.Request = Class.create(Ajax.Base, {
if (readyState > 1 && !((readyState == 4) && this._complete))
this.respondToReadyState(this.transport.readyState);
},
-
+
setRequestHeaders: function() {
var headers = {
'X-Requested-With': 'XMLHttpRequest',
@@ -156,47 +156,47 @@ Ajax.Request = Class.create(Ajax.Base, {
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
-
+
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
- * Content-length header. See Mozilla Bugzilla #246651.
+ * Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
-
+
// user-defined headers
if (typeof this.options.requestHeaders == 'object') {
var extras = this.options.requestHeaders;
if (Object.isFunction(extras.push))
- for (var i = 0, length = extras.length; i < length; i += 2)
+ for (var i = 0, length = extras.length; i < length; i += 2)
headers[extras[i]] = extras[i+1];
else
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
}
- for (var name in headers)
+ for (var name in headers)
this.transport.setRequestHeader(name, headers[name]);
},
-
+
/**
* Ajax.Request#success() -> Boolean
- *
+ *
* Tests whether the request was successful.
**/
success: function() {
var status = this.getStatus();
return !status || (status >= 200 && status < 300);
},
-
+
getStatus: function() {
try {
return this.transport.status || 0;
- } catch (e) { return 0 }
+ } catch (e) { return 0 }
},
-
+
respondToReadyState: function(readyState) {
var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
@@ -209,10 +209,10 @@ Ajax.Request = Class.create(Ajax.Base, {
} catch (e) {
this.dispatchException(e);
}
-
+
var contentType = response.getHeader('Content-type');
if (this.options.evalJS == 'force'
- || (this.options.evalJS && this.isSameOrigin() && contentType
+ || (this.options.evalJS && this.isSameOrigin() && contentType
&& contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();
}
@@ -223,13 +223,13 @@ Ajax.Request = Class.create(Ajax.Base, {
} catch (e) {
this.dispatchException(e);
}
-
+
if (state == 'Complete') {
// avoid memory leak in MSIE: clean up
this.transport.onreadystatechange = Prototype.emptyFunction;
}
},
-
+
isSameOrigin: function() {
var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
@@ -238,12 +238,12 @@ Ajax.Request = Class.create(Ajax.Base, {
port: location.port ? ':' + location.port : ''
}));
},
-
+
/**
* Ajax.Request#getHeader(name) -> String | null
* - name (String): The name of an HTTP header that may have been part of
* the response.
- *
+ *
* Returns the value of the given response header, or `null` if that header
* was not found.
**/
@@ -252,7 +252,7 @@ Ajax.Request = Class.create(Ajax.Base, {
return this.transport.getResponseHeader(name) || null;
} catch (e) { return null; }
},
-
+
evalResponse: function() {
try {
return eval((this.transport.responseText || '').unfilterJSON());
@@ -267,5 +267,5 @@ Ajax.Request = Class.create(Ajax.Base, {
}
});
-Ajax.Request.Events =
+Ajax.Request.Events =
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
diff --git a/src/ajax/responders.js b/src/ajax/responders.js
index 80a8e37..50cfdb6 100644
--- a/src/ajax/responders.js
+++ b/src/ajax/responders.js
@@ -1,29 +1,29 @@
/** section: Ajax
* Ajax.Responders
- *
+ *
* A repository of global listeners notified about every step of
* Prototype-based Ajax requests.
- *
+ *
* Sometimes, you need to provide generic behaviors over all Ajax operations
* happening on the page (through [[Ajax.Request]], [[Ajax.Updater]] or
* [[Ajax.PeriodicalUpdater]]).
- *
+ *
* For instance, you might want to automatically show an indicator when an
* Ajax request is ongoing, and hide it when none are. You may well want to
* factor out exception handling as well, logging those somewhere on the page
* in a custom fashion. The possibilities are myriad.
- *
+ *
* To achieve this, Prototype provides `Ajax.Responders`, which lets you
* register (and, if you wish, unregister later) _responders_, which are
* objects with specially-named methods. These names come from a set of
* general callbacks corresponding to different points in time (or outcomes)
* of an Ajax request's life cycle.
- *
+ *
* For instance, Prototype automatically registers a responder that maintains
* a nifty variable: [[Ajax.activeRequestCount]]. This represents, at a given
- * time, the number of currently active Ajax requests — by monitoring their
+ * time, the number of currently active Ajax requests — by monitoring their
* `onCreate` and `onComplete` events. The code for this is fairly simple:
- *
+ *
* Ajax.Responders.register({
* onCreate: function() {
* Ajax.activeRequestCount++;
@@ -32,16 +32,16 @@
* Ajax.activeRequestCount--;
* }
* });
- *
+ *
* Responder callbacks
- *
+ *
* The callbacks for responders are similar to the callbacks described in
* the [[Ajax section]], but take a different signature. They're invoked with
* three parameters: the requester object (i.e., the corresponding "instance"
* of [[Ajax.Request]]), the `XMLHttpRequest` object, and the result of
* evaluating the `X-JSON` response header, if any (can be `null`). They also
* execute in the context of the responder, bound to the `this` reference.
- *
+ *
* * `onCreate`: Triggered whenever a requester object from the `Ajax`
* namespace is created, after its parameters are adjusted and before its
* XHR connection is opened. This takes *two* arguments: the requester
@@ -61,14 +61,14 @@
* instance), and the second is the exception object.
* * `onComplete`: Triggered at the _very end_ of a request's life-cycle, after
* the request completes, status-specific callbacks are called, and possible
- * automatic behaviors are processed. Guaranteed to run regardless of what
- * happened during the request.
- *
+ * automatic behaviors are processed. Guaranteed to run regardless of what
+ * happened during the request.
+ *
**/
Ajax.Responders = {
responders: [],
-
+
_each: function(iterator) {
this.responders._each(iterator);
},
@@ -77,30 +77,30 @@ Ajax.Responders = {
* Ajax.Responders.register(responder) -> undefined
* - responder (Object): A list of functions with keys corresponding to the
* names of possible callbacks.
- *
+ *
* Add a group of responders to all Ajax requests.
**/
register: function(responder) {
if (!this.include(responder))
this.responders.push(responder);
},
-
+
/**
* Ajax.Responders.unregister(responder) -> undefined
* - responder (Object): A list of functions with keys corresponding to the
* names of possible callbacks.
- *
+ *
* Remove a previously-added group of responders.
- *
+ *
* As always, unregistering something requires you to use the very same
* object you used at registration. If you plan to use `unregister`, be sure
* to assign your responder to a _variable_ before passing it into
- * [[Ajax.Responders#register]] — don't pass it an object literal.
+ * [[Ajax.Responders#register]] — don't pass it an object literal.
**/
unregister: function(responder) {
this.responders = this.responders.without(responder);
},
-
+
dispatch: function(callback, request, transport, json) {
this.each(function(responder) {
if (Object.isFunction(responder[callback])) {
@@ -115,6 +115,6 @@ Ajax.Responders = {
Object.extend(Ajax.Responders, Enumerable);
Ajax.Responders.register({
- onCreate: function() { Ajax.activeRequestCount++ },
+ onCreate: function() { Ajax.activeRequestCount++ },
onComplete: function() { Ajax.activeRequestCount-- }
});
diff --git a/src/ajax/response.js b/src/ajax/response.js
index 6224426..4fd9baa 100644
--- a/src/ajax/response.js
+++ b/src/ajax/response.js
@@ -1,9 +1,9 @@
/** section: Ajax
* class Ajax.Response
- *
+ *
* A wrapper class around `XmlHttpRequest` for dealing with HTTP responses
* of Ajax requests.
- *
+ *
* An instance of `Ajax.Response` is passed as the first argument of all Ajax
* requests' callbacks. You _will not_ need to create instances of
* `Ajax.Response` yourself.
@@ -11,49 +11,49 @@
/**
* Ajax.Response#readyState -> Number
- *
- * The request’s current state.
- *
+ *
+ * The request's current state.
+ *
* `0` corresponds to `"Uninitialized"`, `1` to `"Loading"`, `2` to
* `"Loaded"`, `3` to `"Interactive"`, and `4` to `"Complete"`.
**/
/**
* Ajax.Response#responseText -> String
- *
+ *
* The text body of the response.
**/
/**
* Ajax.Response#responseXML -> document | null
- *
+ *
* The XML body of the response if the `Content-type` of the request is set
* to `application/xml`; `null` otherwise.
**/
/**
* Ajax.Response#responseJSON -> Object | Array | null
- *
+ *
* The JSON body of the response if the `Content-type` of the request is set
* to `application/json`; `null` otherwise.
**/
/**
* Ajax.Response#headerJSON -> Object | Array | null
- *
+ *
* Auto-evaluated content of the `X-JSON` header if present; `null` otherwise.
**/
/**
* Ajax.Response#request -> Ajax.Request | Ajax.Updater
- *
+ *
* The request object itself (an instance of [[Ajax.Request]] or
* [[Ajax.Updater]]).
**/
/**
* Ajax.Response#transport -> XmlHttpRequest
- *
+ *
* The native `XmlHttpRequest` object itself.
**/
@@ -63,53 +63,53 @@ Ajax.Response = Class.create({
this.request = request;
var transport = this.transport = request.transport,
readyState = this.readyState = transport.readyState;
-
+
if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
this.status = this.getStatus();
this.statusText = this.getStatusText();
this.responseText = String.interpret(transport.responseText);
this.headerJSON = this._getHeaderJSON();
}
-
+
if(readyState == 4) {
var xml = transport.responseXML;
this.responseXML = Object.isUndefined(xml) ? null : xml;
this.responseJSON = this._getResponseJSON();
}
},
-
+
/**
* Ajax.Response#status -> Number
- *
+ *
* The HTTP status code sent by the server.
**/
status: 0,
-
+
/**
* Ajax.Response#statusText -> String
- *
+ *
* The HTTP status text sent by the server.
**/
statusText: '',
-
+
getStatus: Ajax.Request.prototype.getStatus,
-
+
getStatusText: function() {
try {
return this.transport.statusText || '';
} catch (e) { return '' }
},
-
+
/**
* Ajax.Response#getHeader(name) -> String | null
- *
+ *
* See [[Ajax.Request#getHeader]].
**/
getHeader: Ajax.Request.prototype.getHeader,
-
+
/**
* Ajax.Response#getAllHeaders() -> String | null
- *
+ *
* Returns a string containing all headers separated by line breaks. _Does
* not__ throw errors if no headers are present the way its native
* counterpart does.
@@ -117,12 +117,12 @@ Ajax.Response = Class.create({
getAllHeaders: function() {
try {
return this.getAllResponseHeaders();
- } catch (e) { return null }
+ } catch (e) { return null }
},
-
+
/**
* Ajax.Response.getResponseHeader(name) -> String
- *
+ *
* Returns the value of the requested header if present; throws an error
* otherwise. This is just a wrapper around the `XmlHttpRequest` method of
* the same name.
@@ -130,10 +130,10 @@ Ajax.Response = Class.create({
getResponseHeader: function(name) {
return this.transport.getResponseHeader(name);
},
-
+
/**
* Ajax.Response.getAllResponseHeaders() -> String
- *
+ *
* Returns a string containing all headers separated by line breaks; throws
* an error if no headers exist. This is just a wrapper around the
* `XmlHttpRequest` method of the same name.
@@ -141,7 +141,7 @@ Ajax.Response = Class.create({
getAllResponseHeaders: function() {
return this.transport.getAllResponseHeaders();
},
-
+
_getHeaderJSON: function() {
var json = this.getHeader('X-JSON');
if (!json) return null;
@@ -153,11 +153,11 @@ Ajax.Response = Class.create({
this.request.dispatchException(e);
}
},
-
+
_getResponseJSON: function() {
var options = this.request.options;
- if (!options.evalJSON || (options.evalJSON != 'force' &&
- !(this.getHeader('Content-type') || '').include('application/json')) ||
+ if (!options.evalJSON || (options.evalJSON != 'force' &&
+ !(this.getHeader('Content-type') || '').include('application/json')) ||
this.responseText.blank())
return null;
try {
diff --git a/src/ajax/updater.js b/src/ajax/updater.js
index c923d55..d1a2bc8 100644
--- a/src/ajax/updater.js
+++ b/src/ajax/updater.js
@@ -1,99 +1,99 @@
/** section: Ajax
* class Ajax.Updater < Ajax.Request
- *
- * A class that performs an Ajax request and updates a container’s contents
+ *
+ * A class that performs an Ajax request and updates a container's contents
* with the contents of the response.
- *
+ *
* `Ajax.Updater` is a subclass of [[Ajax.Request]] built for a common
* use-case.
- *
+ *
* Example
- *
+ *
* new Ajax.Updater('items', '/items', {
* parameters: { text: $F('text') }
* });
- *
+ *
* This example will make a request to the URL `/items` (with the given
* parameters); it will then replace the contents of the element with the ID
* of `items` with whatever response it receives.
- *
+ *
* Callbacks
- *
+ *
* `Ajax.Updater` supports all the callbacks listed in the [[Ajax section]].
* Note that the `onComplete` callback will be invoked **after** the element
* is updated.
- *
+ *
* Additional options
- *
+ *
* `Ajax.Updater` has some options of its own apart from the common options
* described in the [[Ajax section]]:
- *
+ *
* * `evalScripts` ([[Boolean]]; defaults to `false`): Whether `