git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e2f4a0
)
Make toArray an alias for .get(). Closes #3999
author
Yehuda Katz
<wycats@gmail.com>
Thu, 16 Jul 2009 07:31:32 +0000
(07:31 +0000)
committer
Yehuda Katz
<wycats@gmail.com>
Thu, 16 Jul 2009 07:31:32 +0000
(07:31 +0000)
src/core.js
patch
|
blob
|
history
test/unit/core.js
patch
|
blob
|
history
diff --git
a/src/core.js
b/src/core.js
index
ee4ac70
..
35e6e34
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-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 whole matched element set as a clean array
get: function( num ) {
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
@@
-313,7
+315,7
@@
jQuery.extend({
// args is for internal usage only
each: function( object, callback, args ) {
// args is for internal usage only
each: function( object, callback, args ) {
- var name, i = 0,
+ var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction(object);
length = object.length,
isObj = length === undefined || jQuery.isFunction(object);
diff --git
a/test/unit/core.js
b/test/unit/core.js
index
ac93dda
..
aad9e6e
100644
(file)
--- a/
test/unit/core.js
+++ b/
test/unit/core.js
@@
-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() {
expect(1);
equals( jQuery("p").get(0), document.getElementById("firstp"), "Get A Single Element" );
test("get(Number)", function() {
expect(1);
equals( jQuery("p").get(0), document.getElementById("firstp"), "Get A Single Element" );