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
bd6eb849
Commit
bd6eb849
authored
Jan 19, 2011
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revised how context is determined and removed unnecessary "parameter as variable" trick.
parent
92c3d87a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
ajax.js
src/ajax.js
+10
-12
No files found.
src/ajax.js
View file @
bd6eb849
...
@@ -233,8 +233,7 @@ jQuery.extend({
...
@@ -233,8 +233,7 @@ jQuery.extend({
},
},
// Main method
// Main method
// (s is used internally)
ajax
:
function
(
url
,
options
)
{
ajax
:
function
(
url
,
options
,
s
)
{
// Handle varargs
// Handle varargs
if
(
arguments
.
length
===
1
)
{
if
(
arguments
.
length
===
1
)
{
...
@@ -248,19 +247,14 @@ jQuery.extend({
...
@@ -248,19 +247,14 @@ jQuery.extend({
// Get the url if provided separately
// Get the url if provided separately
options
.
url
=
url
||
options
.
url
;
options
.
url
=
url
||
options
.
url
;
// Create the final options object
var
// Create the final options object
s
=
jQuery
.
extend
(
true
,
{}
,
jQuery
.
ajaxSettings
,
options
);
s
=
jQuery
.
extend
(
true
,
{}
,
jQuery
.
ajaxSettings
,
options
),
// jQuery lists
// We force the original context
// (plain objects used as context get extended)
s
.
context
=
options
.
context
;
var
// jQuery lists
jQuery_lastModified
=
jQuery
.
lastModified
,
jQuery_lastModified
=
jQuery
.
lastModified
,
jQuery_etag
=
jQuery
.
etag
,
jQuery_etag
=
jQuery
.
etag
,
// Callbacks contexts
// Callbacks contexts
callbackContext
=
s
.
context
||
s
,
callbackContext
=
options
.
context
||
s
.
context
||
s
,
globalEventContext
=
s
.
context
?
jQuery
(
s
.
context
)
:
jQuery
.
event
,
globalEventContext
=
callbackContext
===
s
?
jQuery
.
event
:
jQuery
(
callbackContext
)
,
// Deferreds
// Deferreds
deferred
=
jQuery
.
Deferred
(),
deferred
=
jQuery
.
Deferred
(),
completeDeferred
=
jQuery
.
_Deferred
(),
completeDeferred
=
jQuery
.
_Deferred
(),
...
@@ -337,6 +331,10 @@ jQuery.extend({
...
@@ -337,6 +331,10 @@ jQuery.extend({
}
}
};
};
// We force the original context
// (plain objects used as context get extended)
s
.
context
=
options
.
context
;
// Callback for when everything is done
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
// at the end of the function (which would be more logical and readable)
...
...
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