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
3d3237c1
Commit
3d3237c1
authored
Jan 10, 2007
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We've decided against .set() and are moving back to .pushStack().
parent
378bb9de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
jquery.js
src/jquery/jquery.js
+11
-11
No files found.
src/jquery/jquery.js
View file @
3d3237c1
...
...
@@ -245,16 +245,16 @@ jQuery.fn = jQuery.prototype = {
* Set the jQuery object to an array of elements, while maintaining
* the stack.
*
* @example $("img").
set
([ document.body ]);
* @result $("img").
set
() == [ document.body ]
* @example $("img").
pushStack
([ document.body ]);
* @result $("img").
pushStack
() == [ document.body ]
*
* @private
* @name
set
* @name
pushStack
* @type jQuery
* @param Elements elems An array of elements
* @cat Core
*/
set
:
function
(
a
)
{
pushStack
:
function
(
a
)
{
var
ret
=
jQuery
(
this
);
ret
.
prevObject
=
this
;
return
ret
.
setArray
(
a
);
...
...
@@ -262,7 +262,7 @@ jQuery.fn = jQuery.prototype = {
/**
* Set the jQuery object to an array of elements. This operation is
* completely destructive - be sure to use .
set
() if you wish to maintain
* completely destructive - be sure to use .
pushStack
() if you wish to maintain
* the jQuery stack.
*
* @example $("img").setArray([ document.body ]);
...
...
@@ -781,7 +781,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
find
:
function
(
t
)
{
return
this
.
set
(
jQuery
.
map
(
this
,
function
(
a
){
return
this
.
pushStack
(
jQuery
.
map
(
this
,
function
(
a
){
return
jQuery
.
find
(
t
,
a
);
})
);
},
...
...
@@ -802,7 +802,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Manipulation
*/
clone
:
function
(
deep
)
{
return
this
.
set
(
jQuery
.
map
(
this
,
function
(
a
){
return
this
.
pushStack
(
jQuery
.
map
(
this
,
function
(
a
){
return
a
.
cloneNode
(
deep
!=
undefined
?
deep
:
true
);
})
);
},
...
...
@@ -848,7 +848,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
filter
:
function
(
t
)
{
return
this
.
set
(
return
this
.
pushStack
(
t
.
constructor
==
Array
&&
jQuery
.
map
(
this
,
function
(
a
){
for
(
var
i
=
0
,
tl
=
t
.
length
;
i
<
tl
;
i
++
)
...
...
@@ -897,7 +897,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
not
:
function
(
t
)
{
return
this
.
set
(
typeof
t
==
"string"
?
return
this
.
pushStack
(
typeof
t
==
"string"
?
jQuery
.
filter
(
t
,
this
,
true
).
r
:
jQuery
.
grep
(
this
,
function
(
a
){
return
a
!=
t
;
})
);
},
...
...
@@ -948,7 +948,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
add
:
function
(
t
)
{
return
this
.
set
(
jQuery
.
merge
(
return
this
.
pushStack
(
jQuery
.
merge
(
this
.
get
(),
typeof
t
==
"string"
?
jQuery
(
t
).
get
()
:
t
)
);
...
...
@@ -1827,7 +1827,7 @@ jQuery.each({
var
ret
=
jQuery
.
map
(
this
,
n
);
if
(
a
&&
typeof
a
==
"string"
)
ret
=
jQuery
.
filter
(
a
,
ret
).
r
;
return
this
.
set
(
ret
);
return
this
.
pushStack
(
ret
);
};
});
...
...
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