Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
cb49b4a1
Commit
cb49b4a1
authored
Feb 01, 2011
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #8115. Renames all references to jXHR with jqXHR in the code (like was done in the doc).
parent
375b7878
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
64 deletions
+64
-64
ajax.js
src/ajax.js
+44
-44
jsonp.js
src/ajax/jsonp.js
+2
-2
ajax.js
test/unit/ajax.js
+18
-18
No files found.
src/ajax.js
View file @
cb49b4a1
...
@@ -73,7 +73,7 @@ function addToPrefiltersOrTransports( structure ) {
...
@@ -73,7 +73,7 @@ function addToPrefiltersOrTransports( structure ) {
}
}
//Base inspection function for prefilters and transports
//Base inspection function for prefilters and transports
function
inspectPrefiltersOrTransports
(
structure
,
options
,
originalOptions
,
jXHR
,
function
inspectPrefiltersOrTransports
(
structure
,
options
,
originalOptions
,
j
q
XHR
,
dataType
/* internal */
,
inspected
/* internal */
)
{
dataType
/* internal */
,
inspected
/* internal */
)
{
dataType
=
dataType
||
options
.
dataTypes
[
0
];
dataType
=
dataType
||
options
.
dataTypes
[
0
];
...
@@ -88,7 +88,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
...
@@ -88,7 +88,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
selection
;
selection
;
for
(;
i
<
length
&&
(
executeOnly
||
!
selection
);
i
++
)
{
for
(;
i
<
length
&&
(
executeOnly
||
!
selection
);
i
++
)
{
selection
=
list
[
i
](
options
,
originalOptions
,
jXHR
);
selection
=
list
[
i
](
options
,
originalOptions
,
j
q
XHR
);
// If we got redirected to another dataType
// If we got redirected to another dataType
// we try there if not done already
// we try there if not done already
if
(
typeof
selection
===
"string"
)
{
if
(
typeof
selection
===
"string"
)
{
...
@@ -97,7 +97,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
...
@@ -97,7 +97,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
}
else
{
}
else
{
options
.
dataTypes
.
unshift
(
selection
);
options
.
dataTypes
.
unshift
(
selection
);
selection
=
inspectPrefiltersOrTransports
(
selection
=
inspectPrefiltersOrTransports
(
structure
,
options
,
originalOptions
,
jXHR
,
selection
,
inspected
);
structure
,
options
,
originalOptions
,
j
q
XHR
,
selection
,
inspected
);
}
}
}
}
}
}
...
@@ -105,7 +105,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
...
@@ -105,7 +105,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jXH
// we try the catchall dataType if not done already
// we try the catchall dataType if not done already
if
(
(
executeOnly
||
!
selection
)
&&
!
inspected
[
"*"
]
)
{
if
(
(
executeOnly
||
!
selection
)
&&
!
inspected
[
"*"
]
)
{
selection
=
inspectPrefiltersOrTransports
(
selection
=
inspectPrefiltersOrTransports
(
structure
,
options
,
originalOptions
,
jXHR
,
"*"
,
inspected
);
structure
,
options
,
originalOptions
,
j
q
XHR
,
"*"
,
inspected
);
}
}
// unnecessary when only executing (prefilters)
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
// but it'll be ignored by the caller in that case
...
@@ -155,14 +155,14 @@ jQuery.fn.extend({
...
@@ -155,14 +155,14 @@ jQuery.fn.extend({
dataType
:
"html"
,
dataType
:
"html"
,
data
:
params
,
data
:
params
,
// Complete callback (responseText is used internally)
// Complete callback (responseText is used internally)
complete
:
function
(
jXHR
,
status
,
responseText
)
{
complete
:
function
(
j
q
XHR
,
status
,
responseText
)
{
// Store the response as specified by the jXHR object
// Store the response as specified by the j
q
XHR object
responseText
=
jXHR
.
responseText
;
responseText
=
j
q
XHR
.
responseText
;
// If successful, inject the HTML into all the matched elements
// If successful, inject the HTML into all the matched elements
if
(
jXHR
.
isResolved
()
)
{
if
(
j
q
XHR
.
isResolved
()
)
{
// #4825: Get the actual response in case
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
// a dataFilter is present in ajaxSettings
jXHR
.
done
(
function
(
r
)
{
j
q
XHR
.
done
(
function
(
r
)
{
responseText
=
r
;
responseText
=
r
;
});
});
// See if a selector was specified
// See if a selector was specified
...
@@ -181,7 +181,7 @@ jQuery.fn.extend({
...
@@ -181,7 +181,7 @@ jQuery.fn.extend({
}
}
if
(
callback
)
{
if
(
callback
)
{
self
.
each
(
callback
,
[
responseText
,
status
,
jXHR
]
);
self
.
each
(
callback
,
[
responseText
,
status
,
j
q
XHR
]
);
}
}
}
}
});
});
...
@@ -364,12 +364,12 @@ jQuery.extend({
...
@@ -364,12 +364,12 @@ jQuery.extend({
loc
=
document
.
location
,
loc
=
document
.
location
,
protocol
=
loc
.
protocol
||
"http:"
,
protocol
=
loc
.
protocol
||
"http:"
,
parts
,
parts
,
// The jXHR state
// The j
q
XHR state
state
=
0
,
state
=
0
,
// Loop variable
// Loop variable
i
,
i
,
// Fake xhr
// Fake xhr
jXHR
=
{
j
q
XHR
=
{
readyState
:
0
,
readyState
:
0
,
...
@@ -431,19 +431,19 @@ jQuery.extend({
...
@@ -431,19 +431,19 @@ jQuery.extend({
}
}
// Dereference transport for early garbage collection
// Dereference transport for early garbage collection
// (no matter how long the jXHR object will be used)
// (no matter how long the j
q
XHR object will be used)
transport
=
undefined
;
transport
=
undefined
;
// Cache response headers
// Cache response headers
responseHeadersString
=
headers
||
""
;
responseHeadersString
=
headers
||
""
;
// Set readyState
// Set readyState
jXHR
.
readyState
=
status
?
4
:
0
;
j
q
XHR
.
readyState
=
status
?
4
:
0
;
var
isSuccess
,
var
isSuccess
,
success
,
success
,
error
,
error
,
response
=
responses
?
ajaxHandleResponses
(
s
,
jXHR
,
responses
)
:
undefined
,
response
=
responses
?
ajaxHandleResponses
(
s
,
j
q
XHR
,
responses
)
:
undefined
,
lastModified
,
lastModified
,
etag
;
etag
;
...
@@ -453,10 +453,10 @@ jQuery.extend({
...
@@ -453,10 +453,10 @@ jQuery.extend({
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if
(
s
.
ifModified
)
{
if
(
s
.
ifModified
)
{
if
(
(
lastModified
=
jXHR
.
getResponseHeader
(
"Last-Modified"
)
)
)
{
if
(
(
lastModified
=
j
q
XHR
.
getResponseHeader
(
"Last-Modified"
)
)
)
{
jQuery
.
lastModified
[
ifModifiedKey
]
=
lastModified
;
jQuery
.
lastModified
[
ifModifiedKey
]
=
lastModified
;
}
}
if
(
(
etag
=
jXHR
.
getResponseHeader
(
"Etag"
)
)
)
{
if
(
(
etag
=
j
q
XHR
.
getResponseHeader
(
"Etag"
)
)
)
{
jQuery
.
etag
[
ifModifiedKey
]
=
etag
;
jQuery
.
etag
[
ifModifiedKey
]
=
etag
;
}
}
}
}
...
@@ -493,30 +493,30 @@ jQuery.extend({
...
@@ -493,30 +493,30 @@ jQuery.extend({
}
}
// Set data for the fake xhr object
// Set data for the fake xhr object
jXHR
.
status
=
status
;
j
q
XHR
.
status
=
status
;
jXHR
.
statusText
=
statusText
;
j
q
XHR
.
statusText
=
statusText
;
// Success/Error
// Success/Error
if
(
isSuccess
)
{
if
(
isSuccess
)
{
deferred
.
resolveWith
(
callbackContext
,
[
success
,
statusText
,
jXHR
]
);
deferred
.
resolveWith
(
callbackContext
,
[
success
,
statusText
,
j
q
XHR
]
);
}
else
{
}
else
{
deferred
.
rejectWith
(
callbackContext
,
[
jXHR
,
statusText
,
error
]
);
deferred
.
rejectWith
(
callbackContext
,
[
j
q
XHR
,
statusText
,
error
]
);
}
}
// Status-dependent callbacks
// Status-dependent callbacks
jXHR
.
statusCode
(
statusCode
);
j
q
XHR
.
statusCode
(
statusCode
);
statusCode
=
undefined
;
statusCode
=
undefined
;
if
(
s
.
global
)
{
if
(
s
.
global
)
{
globalEventContext
.
trigger
(
"ajax"
+
(
isSuccess
?
"Success"
:
"Error"
),
globalEventContext
.
trigger
(
"ajax"
+
(
isSuccess
?
"Success"
:
"Error"
),
[
jXHR
,
s
,
isSuccess
?
success
:
error
]
);
[
j
q
XHR
,
s
,
isSuccess
?
success
:
error
]
);
}
}
// Complete
// Complete
completeDeferred
.
resolveWith
(
callbackContext
,
[
jXHR
,
statusText
]
);
completeDeferred
.
resolveWith
(
callbackContext
,
[
j
q
XHR
,
statusText
]
);
if
(
s
.
global
)
{
if
(
s
.
global
)
{
globalEventContext
.
trigger
(
"ajaxComplete"
,
[
jXHR
,
s
]
);
globalEventContext
.
trigger
(
"ajaxComplete"
,
[
j
q
XHR
,
s
]
);
// Handle the global AJAX counter
// Handle the global AJAX counter
if
(
!
(
--
jQuery
.
active
)
)
{
if
(
!
(
--
jQuery
.
active
)
)
{
jQuery
.
event
.
trigger
(
"ajaxStop"
);
jQuery
.
event
.
trigger
(
"ajaxStop"
);
...
@@ -525,13 +525,13 @@ jQuery.extend({
...
@@ -525,13 +525,13 @@ jQuery.extend({
}
}
// Attach deferreds
// Attach deferreds
deferred
.
promise
(
jXHR
);
deferred
.
promise
(
j
q
XHR
);
j
XHR
.
success
=
j
XHR
.
done
;
j
qXHR
.
success
=
jq
XHR
.
done
;
j
XHR
.
error
=
j
XHR
.
fail
;
j
qXHR
.
error
=
jq
XHR
.
fail
;
jXHR
.
complete
=
completeDeferred
.
done
;
j
q
XHR
.
complete
=
completeDeferred
.
done
;
// Status-dependent callbacks
// Status-dependent callbacks
jXHR
.
statusCode
=
function
(
map
)
{
j
q
XHR
.
statusCode
=
function
(
map
)
{
if
(
map
)
{
if
(
map
)
{
var
tmp
;
var
tmp
;
if
(
state
<
2
)
{
if
(
state
<
2
)
{
...
@@ -539,8 +539,8 @@ jQuery.extend({
...
@@ -539,8 +539,8 @@ jQuery.extend({
statusCode
[
tmp
]
=
[
statusCode
[
tmp
],
map
[
tmp
]
];
statusCode
[
tmp
]
=
[
statusCode
[
tmp
],
map
[
tmp
]
];
}
}
}
else
{
}
else
{
tmp
=
map
[
jXHR
.
status
];
tmp
=
map
[
j
q
XHR
.
status
];
jXHR
.
then
(
tmp
,
tmp
);
j
q
XHR
.
then
(
tmp
,
tmp
);
}
}
}
}
return
this
;
return
this
;
...
@@ -570,7 +570,7 @@ jQuery.extend({
...
@@ -570,7 +570,7 @@ jQuery.extend({
}
}
// Apply prefilters
// Apply prefilters
inspectPrefiltersOrTransports
(
prefilters
,
s
,
options
,
jXHR
);
inspectPrefiltersOrTransports
(
prefilters
,
s
,
options
,
j
q
XHR
);
// Uppercase the type
// Uppercase the type
s
.
type
=
s
.
type
.
toUpperCase
();
s
.
type
=
s
.
type
.
toUpperCase
();
...
@@ -633,36 +633,36 @@ jQuery.extend({
...
@@ -633,36 +633,36 @@ jQuery.extend({
}
}
// Allow custom headers/mimetypes and early abort
// Allow custom headers/mimetypes and early abort
if
(
s
.
beforeSend
&&
(
s
.
beforeSend
.
call
(
callbackContext
,
jXHR
,
s
)
===
false
||
state
===
2
)
)
{
if
(
s
.
beforeSend
&&
(
s
.
beforeSend
.
call
(
callbackContext
,
j
q
XHR
,
s
)
===
false
||
state
===
2
)
)
{
// Abort if not done already
// Abort if not done already
done
(
0
,
"abort"
);
done
(
0
,
"abort"
);
// Return false
// Return false
jXHR
=
false
;
j
q
XHR
=
false
;
}
else
{
}
else
{
// Install callbacks on deferreds
// Install callbacks on deferreds
for
(
i
in
{
success
:
1
,
error
:
1
,
complete
:
1
}
)
{
for
(
i
in
{
success
:
1
,
error
:
1
,
complete
:
1
}
)
{
jXHR
[
i
](
s
[
i
]
);
j
q
XHR
[
i
](
s
[
i
]
);
}
}
// Get transport
// Get transport
transport
=
inspectPrefiltersOrTransports
(
transports
,
s
,
options
,
jXHR
);
transport
=
inspectPrefiltersOrTransports
(
transports
,
s
,
options
,
j
q
XHR
);
// If no transport, we auto-abort
// If no transport, we auto-abort
if
(
!
transport
)
{
if
(
!
transport
)
{
done
(
-
1
,
"No Transport"
);
done
(
-
1
,
"No Transport"
);
}
else
{
}
else
{
// Set state as sending
// Set state as sending
state
=
jXHR
.
readyState
=
1
;
state
=
j
q
XHR
.
readyState
=
1
;
// Send global event
// Send global event
if
(
s
.
global
)
{
if
(
s
.
global
)
{
globalEventContext
.
trigger
(
"ajaxSend"
,
[
jXHR
,
s
]
);
globalEventContext
.
trigger
(
"ajaxSend"
,
[
j
q
XHR
,
s
]
);
}
}
// Timeout
// Timeout
if
(
s
.
async
&&
s
.
timeout
>
0
)
{
if
(
s
.
async
&&
s
.
timeout
>
0
)
{
timeoutTimer
=
setTimeout
(
function
(){
timeoutTimer
=
setTimeout
(
function
(){
jXHR
.
abort
(
"timeout"
);
j
q
XHR
.
abort
(
"timeout"
);
},
s
.
timeout
);
},
s
.
timeout
);
}
}
...
@@ -679,7 +679,7 @@ jQuery.extend({
...
@@ -679,7 +679,7 @@ jQuery.extend({
}
}
}
}
}
}
return
jXHR
;
return
j
q
XHR
;
},
},
// Serialize an array of form elements or a set of
// Serialize an array of form elements or a set of
...
@@ -774,7 +774,7 @@ jQuery.extend({
...
@@ -774,7 +774,7 @@ jQuery.extend({
* - finds the right dataType (mediates between content-type and expected dataType)
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
* - returns the corresponding response
*/
*/
function
ajaxHandleResponses
(
s
,
jXHR
,
responses
)
{
function
ajaxHandleResponses
(
s
,
j
q
XHR
,
responses
)
{
var
contents
=
s
.
contents
,
var
contents
=
s
.
contents
,
dataTypes
=
s
.
dataTypes
,
dataTypes
=
s
.
dataTypes
,
...
@@ -787,7 +787,7 @@ function ajaxHandleResponses( s, jXHR, responses ) {
...
@@ -787,7 +787,7 @@ function ajaxHandleResponses( s, jXHR, responses ) {
// Fill responseXXX fields
// Fill responseXXX fields
for
(
type
in
responseFields
)
{
for
(
type
in
responseFields
)
{
if
(
type
in
responses
)
{
if
(
type
in
responses
)
{
jXHR
[
responseFields
[
type
]
]
=
responses
[
type
];
j
q
XHR
[
responseFields
[
type
]
]
=
responses
[
type
];
}
}
}
}
...
@@ -795,7 +795,7 @@ function ajaxHandleResponses( s, jXHR, responses ) {
...
@@ -795,7 +795,7 @@ function ajaxHandleResponses( s, jXHR, responses ) {
while
(
dataTypes
[
0
]
===
"*"
)
{
while
(
dataTypes
[
0
]
===
"*"
)
{
dataTypes
.
shift
();
dataTypes
.
shift
();
if
(
ct
===
undefined
)
{
if
(
ct
===
undefined
)
{
ct
=
jXHR
.
getResponseHeader
(
"content-type"
);
ct
=
j
q
XHR
.
getResponseHeader
(
"content-type"
);
}
}
}
}
...
...
src/ajax/jsonp.js
View file @
cb49b4a1
...
@@ -12,7 +12,7 @@ jQuery.ajaxSetup({
...
@@ -12,7 +12,7 @@ jQuery.ajaxSetup({
});
});
// Detect, normalize options and install callbacks for jsonp requests
// Detect, normalize options and install callbacks for jsonp requests
jQuery
.
ajaxPrefilter
(
"json jsonp"
,
function
(
s
,
originalSettings
,
jXHR
)
{
jQuery
.
ajaxPrefilter
(
"json jsonp"
,
function
(
s
,
originalSettings
,
j
q
XHR
)
{
var
dataIsString
=
(
typeof
s
.
data
===
"string"
);
var
dataIsString
=
(
typeof
s
.
data
===
"string"
);
...
@@ -60,7 +60,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jXHR ) {
...
@@ -60,7 +60,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jXHR ) {
};
};
// Install cleanUp function
// Install cleanUp function
jXHR
.
then
(
cleanUp
,
cleanUp
);
j
q
XHR
.
then
(
cleanUp
,
cleanUp
);
// Use data converter to retrieve json after script execution
// Use data converter to retrieve json after script execution
s
.
converters
[
"script json"
]
=
function
()
{
s
.
converters
[
"script json"
]
=
function
()
{
...
...
test/unit/ajax.js
View file @
cb49b4a1
...
@@ -311,7 +311,7 @@ test("jQuery.ajax() - responseText on error", function() {
...
@@ -311,7 +311,7 @@ test("jQuery.ajax() - responseText on error", function() {
jQuery
.
ajax
({
jQuery
.
ajax
({
url
:
url
(
"data/errorWithText.php"
),
url
:
url
(
"data/errorWithText.php"
),
error
:
function
(
xhr
)
{
error
:
function
(
xhr
)
{
strictEqual
(
xhr
.
responseText
,
"plain text message"
,
"Test jXHR.responseText is filled for HTTP errors"
);
strictEqual
(
xhr
.
responseText
,
"plain text message"
,
"Test j
q
XHR.responseText is filled for HTTP errors"
);
},
},
complete
:
function
()
{
complete
:
function
()
{
start
();
start
();
...
@@ -1218,9 +1218,9 @@ test("jQuery.get(String, Hash, Function) - parse xml and use text() on nodes", f
...
@@ -1218,9 +1218,9 @@ test("jQuery.get(String, Hash, Function) - parse xml and use text() on nodes", f
test
(
"jQuery.getScript(String, Function) - with callback"
,
function
()
{
test
(
"jQuery.getScript(String, Function) - with callback"
,
function
()
{
expect
(
3
);
expect
(
3
);
stop
();
stop
();
jQuery
.
getScript
(
url
(
"data/test.js"
),
function
(
data
,
_
,
jXHR
)
{
jQuery
.
getScript
(
url
(
"data/test.js"
),
function
(
data
,
_
,
j
q
XHR
)
{
equals
(
foobar
,
"bar"
,
'Check if script was evaluated'
);
equals
(
foobar
,
"bar"
,
'Check if script was evaluated'
);
strictEqual
(
data
,
jXHR
.
responseText
,
"Same-domain script requests returns the source of the script (#8082)"
);
strictEqual
(
data
,
j
q
XHR
.
responseText
,
"Same-domain script requests returns the source of the script (#8082)"
);
setTimeout
(
start
,
100
);
setTimeout
(
start
,
100
);
});
});
});
});
...
@@ -1394,8 +1394,8 @@ jQuery.each( [ "Same Domain", "Cross Domain" ] , function( crossDomain , label )
...
@@ -1394,8 +1394,8 @@ jQuery.each( [ "Same Domain", "Cross Domain" ] , function( crossDomain , label )
dataType
:
"jsonp"
,
dataType
:
"jsonp"
,
crossDomain
:
crossDomain
,
crossDomain
:
crossDomain
,
jsonpCallback
:
"functionToCleanUp"
,
jsonpCallback
:
"functionToCleanUp"
,
beforeSend
:
function
(
jXHR
)
{
beforeSend
:
function
(
j
q
XHR
)
{
xhr
=
jXHR
;
xhr
=
j
q
XHR
;
return
false
;
return
false
;
}
}
});
});
...
@@ -2072,16 +2072,16 @@ test( "jQuery.ajax - statusCode" , function() {
...
@@ -2072,16 +2072,16 @@ test( "jQuery.ajax - statusCode" , function() {
}).
statusCode
(
createStatusCodes
(
"immediately with method"
,
isSuccess
)
);
}).
statusCode
(
createStatusCodes
(
"immediately with method"
,
isSuccess
)
);
jQuery
.
ajax
(
url
(
uri
)
,
{
jQuery
.
ajax
(
url
(
uri
)
,
{
complete
:
function
(
jXHR
)
{
complete
:
function
(
j
q
XHR
)
{
jXHR
.
statusCode
(
createStatusCodes
(
"on complete"
,
isSuccess
)
);
j
q
XHR
.
statusCode
(
createStatusCodes
(
"on complete"
,
isSuccess
)
);
countComplete
();
countComplete
();
}
}
});
});
jQuery
.
ajax
(
url
(
uri
)
,
{
jQuery
.
ajax
(
url
(
uri
)
,
{
complete
:
function
(
jXHR
)
{
complete
:
function
(
j
q
XHR
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
jXHR
.
statusCode
(
createStatusCodes
(
"very late binding"
,
isSuccess
)
);
j
q
XHR
.
statusCode
(
createStatusCodes
(
"very late binding"
,
isSuccess
)
);
countComplete
();
countComplete
();
}
,
100
);
}
,
100
);
}
}
...
@@ -2089,10 +2089,10 @@ test( "jQuery.ajax - statusCode" , function() {
...
@@ -2089,10 +2089,10 @@ test( "jQuery.ajax - statusCode" , function() {
jQuery
.
ajax
(
url
(
uri
)
,
{
jQuery
.
ajax
(
url
(
uri
)
,
{
statusCode
:
createStatusCodes
(
"all (options)"
,
isSuccess
),
statusCode
:
createStatusCodes
(
"all (options)"
,
isSuccess
),
complete
:
function
(
jXHR
)
{
complete
:
function
(
j
q
XHR
)
{
jXHR
.
statusCode
(
createStatusCodes
(
"all (on complete)"
,
isSuccess
)
);
j
q
XHR
.
statusCode
(
createStatusCodes
(
"all (on complete)"
,
isSuccess
)
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
jXHR
.
statusCode
(
createStatusCodes
(
"all (very late binding)"
,
isSuccess
)
);
j
q
XHR
.
statusCode
(
createStatusCodes
(
"all (very late binding)"
,
isSuccess
)
);
countComplete
();
countComplete
();
}
,
100
);
}
,
100
);
}
}
...
@@ -2101,22 +2101,22 @@ test( "jQuery.ajax - statusCode" , function() {
...
@@ -2101,22 +2101,22 @@ test( "jQuery.ajax - statusCode" , function() {
var
testString
=
""
;
var
testString
=
""
;
jQuery
.
ajax
(
url
(
uri
),
{
jQuery
.
ajax
(
url
(
uri
),
{
success
:
function
(
a
,
b
,
jXHR
)
{
success
:
function
(
a
,
b
,
j
q
XHR
)
{
ok
(
isSuccess
,
"success"
);
ok
(
isSuccess
,
"success"
);
var
statusCode
=
{};
var
statusCode
=
{};
statusCode
[
jXHR
.
status
]
=
function
()
{
statusCode
[
j
q
XHR
.
status
]
=
function
()
{
testString
+=
"B"
;
testString
+=
"B"
;
};
};
jXHR
.
statusCode
(
statusCode
);
j
q
XHR
.
statusCode
(
statusCode
);
testString
+=
"A"
;
testString
+=
"A"
;
},
},
error
:
function
(
jXHR
)
{
error
:
function
(
j
q
XHR
)
{
ok
(
!
isSuccess
,
"error"
);
ok
(
!
isSuccess
,
"error"
);
var
statusCode
=
{};
var
statusCode
=
{};
statusCode
[
jXHR
.
status
]
=
function
()
{
statusCode
[
j
q
XHR
.
status
]
=
function
()
{
testString
+=
"B"
;
testString
+=
"B"
;
};
};
jXHR
.
statusCode
(
statusCode
);
j
q
XHR
.
statusCode
(
statusCode
);
testString
+=
"A"
;
testString
+=
"A"
;
},
},
complete
:
function
()
{
complete
:
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment