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
3ea36640
Commit
3ea36640
authored
Jan 19, 2011
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-adds hastily removed variable and simplifies statusCode based callbacks handling.
parent
7947cd77
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
ajax.js
src/ajax.js
+16
-15
No files found.
src/ajax.js
View file @
3ea36640
...
@@ -368,7 +368,12 @@ jQuery.extend({
...
@@ -368,7 +368,12 @@ jQuery.extend({
// Stored success
// Stored success
success
,
success
,
// Stored error
// Stored error
error
;
error
,
// Keep track of statusCode callbacks
oldStatusCode
=
statusCode
;
statusCode
=
undefined
;
// If successful, handle type chaining
// If successful, handle type chaining
if
(
status
>=
200
&&
status
<
300
||
status
===
304
)
{
if
(
status
>=
200
&&
status
<
300
||
status
===
304
)
{
...
@@ -410,6 +415,8 @@ jQuery.extend({
...
@@ -410,6 +415,8 @@ jQuery.extend({
current
,
current
,
// Previous dataType
// Previous dataType
prev
,
prev
,
// Conversion expression
conversion
,
// Conversion function
// Conversion function
conv
,
conv
,
// Conversion functions (when text is used in-between)
// Conversion functions (when text is used in-between)
...
@@ -448,8 +455,8 @@ jQuery.extend({
...
@@ -448,8 +455,8 @@ jQuery.extend({
if
(
prev
!==
"*"
&&
current
!==
"*"
&&
prev
!==
current
)
{
if
(
prev
!==
"*"
&&
current
!==
"*"
&&
prev
!==
current
)
{
// Get the converter
// Get the converter
conv
=
converters
[
prev
+
" "
+
current
]
||
conv
ersion
=
prev
+
" "
+
current
;
converters
[
"* "
+
current
];
conv
=
converters
[
conversion
]
||
converters
[
"* "
+
current
];
conv1
=
conv2
=
0
;
conv1
=
conv2
=
0
;
...
@@ -524,7 +531,7 @@ jQuery.extend({
...
@@ -524,7 +531,7 @@ jQuery.extend({
}
}
// Status-dependent callbacks
// Status-dependent callbacks
jXHR
.
statusCode
(
s
tatusCode
);
jXHR
.
statusCode
(
oldS
tatusCode
);
if
(
s
.
global
)
{
if
(
s
.
global
)
{
globalEventContext
.
trigger
(
"ajax"
+
(
isSuccess
?
"Success"
:
"Error"
)
,
globalEventContext
.
trigger
(
"ajax"
+
(
isSuccess
?
"Success"
:
"Error"
)
,
...
@@ -552,20 +559,14 @@ jQuery.extend({
...
@@ -552,20 +559,14 @@ jQuery.extend({
// Status-dependent callbacks
// Status-dependent callbacks
jXHR
.
statusCode
=
function
(
map
)
{
jXHR
.
statusCode
=
function
(
map
)
{
if
(
map
)
{
if
(
map
)
{
var
resolved
=
jXHR
.
isResolved
(),
var
tmp
;
tmp
;
if
(
statusCode
)
{
if
(
resolved
||
jXHR
.
isRejected
()
)
{
tmp
=
map
[
jXHR
.
status
];
if
(
tmp
)
{
if
(
map
===
statusCode
)
{
delete
statusCode
[
jXHR
.
status
];
}
jXHR
[
resolved
?
"done"
:
"fail"
](
tmp
);
}
}
else
{
for
(
tmp
in
map
)
{
for
(
tmp
in
map
)
{
statusCode
[
tmp
]
=
[
statusCode
[
tmp
]
,
map
[
tmp
]
];
statusCode
[
tmp
]
=
[
statusCode
[
tmp
]
,
map
[
tmp
]
];
}
}
}
else
{
tmp
=
map
[
jXHR
.
status
];
jXHR
.
done
(
tmp
).
fail
(
tmp
);
}
}
}
}
return
this
;
return
this
;
...
...
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