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
874e4f65
Commit
874e4f65
authored
Aug 22, 2006
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a bunch of fixes for AJAX timeouts, etc. in Safari.
parent
25802e8b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
ajax.js
src/ajax/ajax.js
+12
-8
No files found.
src/ajax/ajax.js
View file @
874e4f65
...
@@ -145,6 +145,8 @@ jQuery.extend({
...
@@ -145,6 +145,8 @@ jQuery.extend({
if
(
!
jQuery
.
active
++
)
if
(
!
jQuery
.
active
++
)
jQuery
.
event
.
trigger
(
"ajaxStart"
);
jQuery
.
event
.
trigger
(
"ajaxStart"
);
var
requestDone
=
false
;
// Create the request object
// Create the request object
var
xml
=
new
XMLHttpRequest
();
var
xml
=
new
XMLHttpRequest
();
...
@@ -170,8 +172,10 @@ jQuery.extend({
...
@@ -170,8 +172,10 @@ jQuery.extend({
// Wait for a response to come back
// Wait for a response to come back
var
onreadystatechange
=
function
(
istimeout
){
var
onreadystatechange
=
function
(
istimeout
){
// The transfer is complete and the data is available, or the request timed out
// The transfer is complete and the data is available, or the request timed out
if
(
xml
&&
(
xml
.
readyState
==
4
||
istimeout
)
)
{
if
(
xml
&&
(
xml
.
readyState
==
4
||
istimeout
==
"timeout"
)
)
{
var
status
=
jQuery
.
httpSuccess
(
xml
)
&&
!
istimeout
?
requestDone
=
true
;
var
status
=
jQuery
.
httpSuccess
(
xml
)
&&
istimeout
!=
"timeout"
?
ifModified
&&
jQuery
.
httpNotModified
(
xml
,
url
)
?
"notmodified"
:
"success"
:
"error"
;
ifModified
&&
jQuery
.
httpNotModified
(
xml
,
url
)
?
"notmodified"
:
"success"
:
"error"
;
// Make sure that the request was successful or notmodified
// Make sure that the request was successful or notmodified
...
@@ -221,8 +225,7 @@ jQuery.extend({
...
@@ -221,8 +225,7 @@ jQuery.extend({
// Cancel the request
// Cancel the request
xml
.
abort
();
xml
.
abort
();
// for Opera. Opera does't call onreadystatechange when aborted.
if
(
!
requestDone
)
onreadystatechange
(
"timeout"
);
if
(
xml
)
onreadystatechange
(
1
);
// Clear from memory
// Clear from memory
xml
=
null
;
xml
=
null
;
...
@@ -239,9 +242,9 @@ jQuery.extend({
...
@@ -239,9 +242,9 @@ jQuery.extend({
// Determines if an XMLHttpRequest was successful or not
// Determines if an XMLHttpRequest was successful or not
httpSuccess
:
function
(
r
)
{
httpSuccess
:
function
(
r
)
{
try
{
try
{
return
r
.
status
?
return
!
r
.
status
&&
location
.
protocol
==
"file:"
||
(
r
.
status
>=
200
&&
r
.
status
<
300
)
||
r
.
status
==
304
:
(
r
.
status
>=
200
&&
r
.
status
<
300
)
||
r
.
status
==
304
||
location
.
protocol
==
"file:"
;
jQuery
.
browser
.
safari
&&
r
.
status
==
undefined
;
}
catch
(
e
){}
}
catch
(
e
){}
return
false
;
return
false
;
...
@@ -253,7 +256,8 @@ jQuery.extend({
...
@@ -253,7 +256,8 @@ jQuery.extend({
var
xmlRes
=
xml
.
getResponseHeader
(
"Last-Modified"
);
var
xmlRes
=
xml
.
getResponseHeader
(
"Last-Modified"
);
// Firefox always returns 200. check Last-Modified date
// Firefox always returns 200. check Last-Modified date
if
(
xml
.
status
==
304
||
xmlRes
==
jQuery
.
lastModified
[
url
]
)
return
true
;
return
xml
.
status
==
304
||
xmlRes
==
jQuery
.
lastModified
[
url
]
||
jQuery
.
browser
.
safari
&&
xml
.
status
==
undefined
;
}
catch
(
e
){}
}
catch
(
e
){}
return
false
;
return
false
;
...
...
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