Handle XHR response error #137
@@ -3,11 +3,11 @@ var newUid = require("../uniqueid.js")
|
||||
|
|
||||
var trigger = require("../events/trigger.js")
|
||||
|
||||
module.exports = function(responseText, request, href) {
|
||||
var tempOptions = clone(this.options);
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
tempOptions.request = request
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
// Fail if unable to load HTML via AJAX
|
||||
if (responseText === false) {
|
||||
var tempOptions = this.options
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
tempOptions.request = request
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
trigger(document, "pjax:complete pjax:error", tempOptions)
|
||||
|
||||
return
|
||||
@@ -55,9 +55,7 @@ module.exports = function(responseText, request, href) {
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
Good point. Good point.
Good point. Good point.
|
||||
this.loadContent(responseText, this.options)
|
||||
}
|
||||
catch (e) {
|
||||
var tempOptions2 = this.options
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
tempOptions2.request = request
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
trigger(document, "pjax:error", tempOptions2)
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
trigger(document, "pjax:error", tempOptions)
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
|
||||
|
||||
if (!this.options.debug) {
|
||||
if (console && console.error) {
|
||||
|
||||
|
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This needs to be This needs to be `tempOptions = clone(this.options)`, or you'll mutate the current instance's options
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
This also needs to clone This also needs to clone `this.options`, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
Good point. Good point.
Good point. Good point.
Good point. Good point.
Good point. Good point.
|
||||
This needs to be
tempOptions = clone(this.options), or you'll mutate the current instance's optionsThis needs to be
tempOptions = clone(this.options), or you'll mutate the current instance's optionsThis also needs to clone
this.options, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.This also needs to clone
this.options, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.Good point.
Good point.
Good point.
Good point.