breaking jquery out into smaller modules. added attributes.js, manipulation.js, and...
[jquery.git] / test / unit / core.js
1 module("core");
2
3 test("Basic requirements", function() {
4         expect(7);
5         ok( Array.prototype.push, "Array.push()" );
6         ok( Function.prototype.apply, "Function.apply()" );
7         ok( document.getElementById, "getElementById" );
8         ok( document.getElementsByTagName, "getElementsByTagName" );
9         ok( RegExp, "RegExp" );
10         ok( jQuery, "jQuery" );
11         ok( $, "$" );
12 });
13
14 test("jQuery()", function() {
15         expect(8);
16
17         var main = jQuery("#main");
18         isSet( jQuery("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
19
20 /*
21         // disabled since this test was doing nothing. i tried to fix it but i'm not sure
22         // what the expected behavior should even be. FF returns "\n" for the text node
23         // make sure this is handled
24         var crlfContainer = jQuery('<p>\r\n</p>');
25         var x = crlfContainer.contents().get(0).nodeValue;
26         equals( x, what???, "Check for \\r and \\n in jQuery()" );
27 */
28
29         /* // Disabled until we add this functionality in
30         var pass = true;
31         try {
32                 jQuery("<div>Testing</div>").appendTo(document.getElementById("iframe").contentDocument.body);
33         } catch(e){
34                 pass = false;
35         }
36         ok( pass, "jQuery('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/
37
38         var code = jQuery("<code/>");
39         equals( code.length, 1, "Correct number of elements generated for code" );
40         var img = jQuery("<img/>");
41         equals( img.length, 1, "Correct number of elements generated for img" );
42         var div = jQuery("<div/><hr/><code/><b/>");
43         equals( div.length, 4, "Correct number of elements generated for div hr code b" );
44
45         // can actually yield more than one, when iframes are included, the window is an array as well
46         equals( jQuery(window).length, 1, "Correct number of elements generated for window" );
47
48         equals( jQuery(document).length, 1, "Correct number of elements generated for document" );
49
50         equals( jQuery([1,2,3]).get(1), 2, "Test passing an array to the factory" );
51
52         equals( jQuery(document.body).get(0), jQuery('body').get(0), "Test passing an html node to the factory" );
53 });
54
55 test("selector state", function() {
56         expect(30);
57
58         var test;
59         
60         test = jQuery();
61         equals( test.selector, "", "Empty jQuery Selector" );
62         equals( test.context, document, "Empty jQuery Context" );
63         
64         test = jQuery(document);
65         equals( test.selector, "", "Document Selector" );
66         equals( test.context, document, "Document Context" );
67         
68         test = jQuery(document.body);
69         equals( test.selector, "", "Body Selector" );
70         equals( test.context, document.body, "Body Context" );
71         
72         test = jQuery("#main");
73         equals( test.selector, "#main", "#main Selector" );
74         equals( test.context, document, "#main Context" );
75
76         test = jQuery("#notfoundnono");
77         equals( test.selector, "#notfoundnono", "#notfoundnono Selector" );
78         equals( test.context, document, "#notfoundnono Context" );
79         
80         test = jQuery("#main", document);
81         equals( test.selector, "#main", "#main Selector" );
82         equals( test.context, document, "#main Context" );
83         
84         test = jQuery("#main", document.body);
85         equals( test.selector, "#main", "#main Selector" );
86         equals( test.context, document.body, "#main Context" );
87
88         // Test cloning
89         test = jQuery(test);
90         equals( test.selector, "#main", "#main Selector" );
91         equals( test.context, document.body, "#main Context" );
92         
93         test = jQuery(document.body).find("#main");
94         equals( test.selector, "#main", "#main find Selector" );
95         equals( test.context, document.body, "#main find Context" );
96
97         test = jQuery("#main").filter("div");
98         equals( test.selector, "#main.filter(div)", "#main filter Selector" );
99         equals( test.context, document, "#main filter Context" );
100         
101         test = jQuery("#main").not("div");
102         equals( test.selector, "#main.not(div)", "#main not Selector" );
103         equals( test.context, document, "#main not Context" );
104         
105         test = jQuery("#main").filter("div").not("div");
106         equals( test.selector, "#main.filter(div).not(div)", "#main filter, not Selector" );
107         equals( test.context, document, "#main filter, not Context" );
108         
109         test = jQuery("#main").filter("div").not("div").end();
110         equals( test.selector, "#main.filter(div)", "#main filter, not, end Selector" );
111         equals( test.context, document, "#main filter, not, end Context" );
112         
113         test = jQuery("#main").parent("body");
114         equals( test.selector, "#main.parent(body)", "#main parent Selector" );
115         equals( test.context, document, "#main parent Context" );
116         
117         test = jQuery("#main").eq(0);
118         equals( test.selector, "#main.slice(0,1)", "#main eq Selector" );
119         equals( test.context, document, "#main eq Context" );
120 });
121
122 test("browser", function() {
123         expect(13);
124         var browsers = {
125                 //Internet Explorer
126                 "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)": "6.0",
127                 "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)": "7.0",
128                 /** Failing #1876
129                  * "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)": "7.0",
130                  */
131                 //Browsers with Gecko engine
132                 //Mozilla
133                 "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915" : "1.7.12",
134                 //Firefox
135                 "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3": "1.8.1.3",
136                 //Netscape
137                 "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3" : "1.7.5",
138                 //Flock
139                 "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070321 Firefox/1.5.0.11 Flock/0.7.12" : "1.8.0.11",
140                 //Opera browser
141                 "Opera/9.20 (X11; Linux x86_64; U; en)": "9.20",
142                 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.20" : "9.20",
143                 "Mozilla/5.0 (Windows NT 5.1; U; pl; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20": "9.20",
144                 //WebKit engine
145                 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3": "418.9",
146                 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" : "418.8",
147                 "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.5": "312.8",
148                 //Other user agent string
149                 "Other browser's user agent 1.0":null
150         };
151         for (var i in browsers) {
152                 var v = i.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ); // RegEx from Core jQuery.browser.version check
153                 var version = v ? v[1] : null;
154                 equals( version, browsers[i], "Checking UA string" );
155         }
156 });
157
158 test("noConflict", function() {
159         expect(6);
160
161         var $$ = jQuery;
162
163         equals( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" );
164         equals( jQuery, $$, "Make sure jQuery wasn't touched." );
165         equals( $, original$, "Make sure $ was reverted." );
166
167         jQuery = $ = $$;
168
169         equals( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" );
170         equals( jQuery, originaljQuery, "Make sure jQuery was reverted." );
171         equals( $, original$, "Make sure $ was reverted." );
172
173         jQuery = $$;
174 });
175
176 test("isFunction", function() {
177         expect(19);
178
179         // Make sure that false values return false
180         ok( !jQuery.isFunction(), "No Value" );
181         ok( !jQuery.isFunction( null ), "null Value" );
182         ok( !jQuery.isFunction( undefined ), "undefined Value" );
183         ok( !jQuery.isFunction( "" ), "Empty String Value" );
184         ok( !jQuery.isFunction( 0 ), "0 Value" );
185
186         // Check built-ins
187         // Safari uses "(Internal Function)"
188         ok( jQuery.isFunction(String), "String Function("+String+")" );
189         ok( jQuery.isFunction(Array), "Array Function("+Array+")" );
190         ok( jQuery.isFunction(Object), "Object Function("+Object+")" );
191         ok( jQuery.isFunction(Function), "Function Function("+Function+")" );
192
193         // When stringified, this could be misinterpreted
194         var mystr = "function";
195         ok( !jQuery.isFunction(mystr), "Function String" );
196
197         // When stringified, this could be misinterpreted
198         var myarr = [ "function" ];
199         ok( !jQuery.isFunction(myarr), "Function Array" );
200
201         // When stringified, this could be misinterpreted
202         var myfunction = { "function": "test" };
203         ok( !jQuery.isFunction(myfunction), "Function Object" );
204
205         // Make sure normal functions still work
206         var fn = function(){};
207         ok( jQuery.isFunction(fn), "Normal Function" );
208
209         var obj = document.createElement("object");
210
211         // Firefox says this is a function
212         ok( !jQuery.isFunction(obj), "Object Element" );
213
214         // IE says this is an object
215         // Since 1.3, this isn't supported (#2968)
216         //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
217
218         var nodes = document.body.childNodes;
219
220         // Safari says this is a function
221         ok( !jQuery.isFunction(nodes), "childNodes Property" );
222
223         var first = document.body.firstChild;
224
225         // Normal elements are reported ok everywhere
226         ok( !jQuery.isFunction(first), "A normal DOM Element" );
227
228         var input = document.createElement("input");
229         input.type = "text";
230         document.body.appendChild( input );
231
232         // IE says this is an object
233         // Since 1.3, this isn't supported (#2968)
234         //ok( jQuery.isFunction(input.focus), "A default function property" );
235
236         document.body.removeChild( input );
237
238         var a = document.createElement("a");
239         a.href = "some-function";
240         document.body.appendChild( a );
241
242         // This serializes with the word 'function' in it
243         ok( !jQuery.isFunction(a), "Anchor Element" );
244
245         document.body.removeChild( a );
246
247         // Recursive function calls have lengths and array-like properties
248         function callme(callback){
249                 function fn(response){
250                         callback(response);
251                 }
252
253                 ok( jQuery.isFunction(fn), "Recursive Function Call" );
254
255                 fn({ some: "data" });
256         };
257
258         callme(function(){
259                 callme(function(){});
260         });
261 });
262
263 test("jQuery('html')", function() {
264         expect(8);
265
266         reset();
267         jQuery.foo = false;
268         var s = jQuery("<script>jQuery.foo='test';</script>")[0];
269         ok( s, "Creating a script" );
270         ok( !jQuery.foo, "Make sure the script wasn't executed prematurely" );
271         jQuery("body").append("<script>jQuery.foo='test';</script>");
272         ok( jQuery.foo, "Executing a scripts contents in the right context" );
273
274         reset();
275         ok( jQuery("<link rel='stylesheet'/>")[0], "Creating a link" );
276
277         ok( !jQuery("<script/>")[0].parentNode, "Create a script" );
278
279         ok( jQuery("<input/>").attr("type", "hidden"), "Create an input and set the type." );
280
281         var j = jQuery("<span>hi</span> there <!-- mon ami -->");
282         ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
283
284         ok( !jQuery("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
285 });
286
287 test("jQuery('html', context)", function() {
288         expect(1);
289
290         var $div = jQuery("<div/>");
291         var $span = jQuery("<span/>", $div);
292         equals($span.length, 1, "Verify a span created with a div context works, #1763");
293 });
294
295 if ( !isLocal ) {
296 test("jQuery(selector, xml).text(str) - Loaded via XML document", function() {
297         expect(2);
298         stop();
299         jQuery.get('data/dashboard.xml', function(xml) {
300                 // tests for #1419 where IE was a problem
301                 var tab = jQuery("tab", xml).eq(0);
302                 equals( tab.text(), "blabla", "Verify initial text correct" );
303                 tab.text("newtext");
304                 equals( tab.text(), "newtext", "Verify new text correct" );
305                 start();
306         });
307 });
308 }
309
310 test("length", function() {
311         expect(1);
312         equals( jQuery("p").length, 6, "Get Number of Elements Found" );
313 });
314
315 test("size()", function() {
316         expect(1);
317         equals( jQuery("p").size(), 6, "Get Number of Elements Found" );
318 });
319
320 test("get()", function() {
321         expect(1);
322         isSet( jQuery("p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
323 });
324
325 test("get(Number)", function() {
326         expect(1);
327         equals( jQuery("p").get(0), document.getElementById("firstp"), "Get A Single Element" );
328 });
329
330 test("add(String|Element|Array|undefined)", function() {
331         expect(12);
332         isSet( jQuery("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
333         isSet( jQuery("#sndp").add( jQuery("#en")[0] ).add( jQuery("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
334         ok( jQuery([]).add(jQuery("#form")[0].elements).length >= 13, "Check elements from array" );
335
336         // For the time being, we're discontinuing support for jQuery(form.elements) since it's ambiguous in IE
337         // use jQuery([]).add(form.elements) instead.
338         //equals( jQuery([]).add(jQuery("#form")[0].elements).length, jQuery(jQuery("#form")[0].elements).length, "Array in constructor must equals array in add()" );
339
340         var x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>")).add(jQuery("<p id='x2'>xxx</p>"));
341         equals( x[0].id, "x1", "Check on-the-fly element1" );
342         equals( x[1].id, "x2", "Check on-the-fly element2" );
343
344         var x = jQuery([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
345         equals( x[0].id, "x1", "Check on-the-fly element1" );
346         equals( x[1].id, "x2", "Check on-the-fly element2" );
347
348         var notDefined;
349         equals( jQuery([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
350
351         // Added after #2811
352         equals( jQuery([]).add([window,document,document.body,document]).length, 3, "Pass an array" );
353         equals( jQuery(document).add(document).length, 1, "Check duplicated elements" );
354         equals( jQuery(window).add(window).length, 1, "Check duplicated elements using the window" );
355         ok( jQuery([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );
356 });
357
358 test("each(Function)", function() {
359         expect(1);
360         var div = jQuery("div");
361         div.each(function(){this.foo = 'zoo';});
362         var pass = true;
363         for ( var i = 0; i < div.size(); i++ ) {
364                 if ( div.get(i).foo != "zoo" ) pass = false;
365         }
366         ok( pass, "Execute a function, Relative" );
367 });
368
369 test("index(Object)", function() {
370         expect(10);
371
372         var elements = jQuery([window, document]),
373                 inputElements = jQuery('#radio1,#radio2,#check1,#check2');
374
375         equals( elements.index(window), 0, "Check for index of elements" );
376         equals( elements.index(document), 1, "Check for index of elements" );
377         equals( inputElements.index(document.getElementById('radio1')), 0, "Check for index of elements" );
378         equals( inputElements.index(document.getElementById('radio2')), 1, "Check for index of elements" );
379         equals( inputElements.index(document.getElementById('check1')), 2, "Check for index of elements" );
380         equals( inputElements.index(document.getElementById('check2')), 3, "Check for index of elements" );
381         equals( inputElements.index(window), -1, "Check for not found index" );
382         equals( inputElements.index(document), -1, "Check for not found index" );
383
384         // enabled since [5500]
385         equals( elements.index( elements ), 0, "Pass in a jQuery object" );
386         equals( elements.index( elements.eq(1) ), 1, "Pass in a jQuery object" );
387 });
388
389 test("jQuery.merge()", function() {
390         expect(6);
391                 
392         var parse = jQuery.merge;
393         
394         same( parse([],[]), [], "Empty arrays" );
395         
396         same( parse([1],[2]), [1,2], "Basic" );
397         same( parse([1,2],[3,4]), [1,2,3,4], "Basic" );
398         
399         same( parse([1,2],[]), [1,2], "Second empty" );
400         same( parse([],[1,2]), [1,2], "First empty" );  
401         
402         // Fixed at [5998], #3641
403         same( parse([-2,-1], [0,1,2]), [-2,-1,0,1,2], "Second array including a zero (falsy)");
404 });
405
406 test("jQuery.extend(Object, Object)", function() {
407         expect(20);
408
409         var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
410                 options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
411                 optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
412                 merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
413                 deep1 = { foo: { bar: true } },
414                 deep1copy = { foo: { bar: true } },
415                 deep2 = { foo: { baz: true }, foo2: document },
416                 deep2copy = { foo: { baz: true }, foo2: document },
417                 deepmerged = { foo: { bar: true, baz: true }, foo2: document };
418
419         jQuery.extend(settings, options);
420         isObj( settings, merged, "Check if extended: settings must be extended" );
421         isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
422
423         jQuery.extend(settings, null, options);
424         isObj( settings, merged, "Check if extended: settings must be extended" );
425         isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
426
427         jQuery.extend(true, deep1, deep2);
428         isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
429         isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
430         equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );
431
432         var nullUndef;
433         nullUndef = jQuery.extend({}, options, { xnumber2: null });
434         ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");
435
436         nullUndef = jQuery.extend({}, options, { xnumber2: undefined });
437         ok( nullUndef.xnumber2 === options.xnumber2, "Check to make sure undefined values are not copied");
438
439         nullUndef = jQuery.extend({}, options, { xnumber0: null });
440         ok( nullUndef.xnumber0 === null, "Check to make sure null values are inserted");
441
442         var target = {};
443         var recursive = { foo:target, bar:5 };
444         jQuery.extend(true, target, recursive);
445         isObj( target, { bar:5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
446
447         var ret = jQuery.extend(true, { foo: [] }, { foo: [0] } ); // 1907
448         equals( ret.foo.length, 1, "Check to make sure a value with coersion 'false' copies over when necessary to fix #1907" );
449
450         var ret = jQuery.extend(true, { foo: "1,2,3" }, { foo: [1, 2, 3] } );
451         ok( typeof ret.foo != "string", "Check to make sure values equal with coersion (but not actually equal) overwrite correctly" );
452
453         var ret = jQuery.extend(true, { foo:"bar" }, { foo:null } );
454         ok( typeof ret.foo !== 'undefined', "Make sure a null value doesn't crash with deep extend, for #1908" );
455
456         var obj = { foo:null };
457         jQuery.extend(true, obj, { foo:"notnull" } );
458         equals( obj.foo, "notnull", "Make sure a null value can be overwritten" );
459
460         function func() {}
461         jQuery.extend(func, { key: "value" } );
462         equals( func.key, "value", "Verify a function can be extended" );
463
464         var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
465                 defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
466                 options1 = { xnumber2: 1, xstring2: "x" },
467                 options1Copy = { xnumber2: 1, xstring2: "x" },
468                 options2 = { xstring2: "xx", xxx: "newstringx" },
469                 options2Copy = { xstring2: "xx", xxx: "newstringx" },
470                 merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
471
472         var settings = jQuery.extend({}, defaults, options1, options2);
473         isObj( settings, merged2, "Check if extended: settings must be extended" );
474         isObj( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
475         isObj( options1, options1Copy, "Check if not modified: options1 must not be modified" );
476         isObj( options2, options2Copy, "Check if not modified: options2 must not be modified" );
477 });
478
479 test("jQuery.each(Object,Function)", function() {
480         expect(12);
481         jQuery.each( [0,1,2], function(i, n){
482                 equals( i, n, "Check array iteration" );
483         });
484
485         jQuery.each( [5,6,7], function(i, n){
486                 equals( i, n - 5, "Check array iteration" );
487         });
488
489         jQuery.each( { name: "name", lang: "lang" }, function(i, n){
490                 equals( i, n, "Check object iteration" );
491         });
492
493         var total = 0;
494         jQuery.each([1,2,3], function(i,v){ total += v; });
495         equals( total, 6, "Looping over an array" );
496         total = 0;
497         jQuery.each([1,2,3], function(i,v){ total += v; if ( i == 1 ) return false; });
498         equals( total, 3, "Looping over an array, with break" );
499         total = 0;
500         jQuery.each({"a":1,"b":2,"c":3}, function(i,v){ total += v; });
501         equals( total, 6, "Looping over an object" );
502         total = 0;
503         jQuery.each({"a":3,"b":3,"c":3}, function(i,v){ total += v; return false; });
504         equals( total, 3, "Looping over an object, with break" );
505 });
506
507 test("jQuery.makeArray", function(){
508         expect(15);
509
510         equals( jQuery.makeArray(jQuery('html>*'))[0].nodeName.toUpperCase(), "HEAD", "Pass makeArray a jQuery object" );
511
512         equals( jQuery.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" );
513
514         equals( (function(){ return jQuery.makeArray(arguments); })(1,2).join(""), "12", "Pass makeArray an arguments array" );
515
516         equals( jQuery.makeArray([1,2,3]).join(""), "123", "Pass makeArray a real array" );
517
518         equals( jQuery.makeArray().length, 0, "Pass nothing to makeArray and expect an empty array" );
519
520         equals( jQuery.makeArray( 0 )[0], 0 , "Pass makeArray a number" );
521
522         equals( jQuery.makeArray( "foo" )[0], "foo", "Pass makeArray a string" );
523
524         equals( jQuery.makeArray( true )[0].constructor, Boolean, "Pass makeArray a boolean" );
525
526         equals( jQuery.makeArray( document.createElement("div") )[0].nodeName.toUpperCase(), "DIV", "Pass makeArray a single node" );
527
528         equals( jQuery.makeArray( {length:2, 0:"a", 1:"b"} ).join(""), "ab", "Pass makeArray an array like map (with length)" );
529
530         ok( !!jQuery.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "Pass makeArray a childNodes array" );
531
532         // function, is tricky as it has length
533         equals( jQuery.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" );
534         
535         //window, also has length
536         equals( jQuery.makeArray(window)[0], window, "Pass makeArray the window" );
537
538         equals( jQuery.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" );
539
540         ok( jQuery.makeArray(document.getElementById('form')).length >= 13, "Pass makeArray a form (treat as elements)" );
541 });