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
e124fec5
Commit
e124fec5
authored
Jul 16, 2009
by
Yehuda Katz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make toArray an alias for .get(). Closes #3999
parent
0e2f4a0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
core.js
src/core.js
+3
-1
core.js
test/unit/core.js
+7
-0
No files found.
src/core.js
View file @
e124fec5
...
@@ -122,6 +122,8 @@ jQuery.fn = jQuery.prototype = {
...
@@ -122,6 +122,8 @@ jQuery.fn = jQuery.prototype = {
return
this
.
length
;
return
this
.
length
;
},
},
toArray
:
Array
.
prototype
.
slice
,
// Get the Nth element in the matched element set OR
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
// Get the whole matched element set as a clean array
get
:
function
(
num
)
{
get
:
function
(
num
)
{
...
...
test/unit/core.js
View file @
e124fec5
...
@@ -328,6 +328,13 @@ test("get()", function() {
...
@@ -328,6 +328,13 @@ test("get()", function() {
isSet
(
jQuery
(
"p"
).
get
(),
q
(
"firstp"
,
"ap"
,
"sndp"
,
"en"
,
"sap"
,
"first"
),
"Get All Elements"
);
isSet
(
jQuery
(
"p"
).
get
(),
q
(
"firstp"
,
"ap"
,
"sndp"
,
"en"
,
"sap"
,
"first"
),
"Get All Elements"
);
});
});
test
(
"toArray()"
,
function
()
{
expect
(
1
);
isSet
(
jQuery
(
"p"
).
toArray
(),
q
(
"firstp"
,
"ap"
,
"sndp"
,
"en"
,
"sap"
,
"first"
),
"Convert jQuery object to an Array"
)
})
test
(
"get(Number)"
,
function
()
{
test
(
"get(Number)"
,
function
()
{
expect
(
1
);
expect
(
1
);
equals
(
jQuery
(
"p"
).
get
(
0
),
document
.
getElementById
(
"firstp"
),
"Get A Single Element"
);
equals
(
jQuery
(
"p"
).
get
(
0
),
document
.
getElementById
(
"firstp"
),
"Get A Single Element"
);
...
...
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