ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );\r
});\r
\r
-test("attr(String, Object)x", function() {\r
- expect(2);\r
- stop();\r
- $.get('data/dashboard.xml', function(xml) { \r
- var titles = [];\r
- $('tab', xml).each(function() {\r
- titles.push($(this).attr('title'));\r
- });\r
- ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );\r
- ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );\r
- start();\r
+if ( location.protocol != "file:" ) {\r
+ test("attr(String, Object)x", function() {\r
+ expect(2);\r
+ stop();\r
+ $.get('data/dashboard.xml', function(xml) { \r
+ var titles = [];\r
+ $('tab', xml).each(function() {\r
+ titles.push($(this).attr('title'));\r
+ });\r
+ ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );\r
+ ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );\r
+ start();\r
+ });\r
});\r
-});\r
+}\r
\r
test("css(String|Hash)", function() {\r
expect(8);\r
* @cat Core
*/
var jQuery = function(a,c) {
+ // If the context is global, return a new object
+ if ( window == this )
+ return new jQuery(a,c);
+
// Make sure that a selection was provided
a = a || document;
+ // HANDLE: $(function)
// Shortcut for document ready
// Safari reports typeof on DOM NodeLists as a function
if ( typeof a == "function" && !a.nodeType && a[0] == undefined )
- return jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
-
- // Watch for when a jQuery object is passed as the selector
- if ( a.jquery )
- return jQuery( jQuery.makeArray( a ) );
-
- // Watch for when a jQuery object is passed at the context
- if ( c && c.jquery )
- return jQuery( c ).find(a);
-
- // If the context is global, return a new object
- if ( window == this )
- return new jQuery(a,c);
-
+ return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
+
// Handle HTML strings
if ( typeof a == "string" ) {
+ // HANDLE: $(html) -> $(array)
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
- if ( m ) a = jQuery.clean( [ m[1] ] );
+ if ( m )
+ a = jQuery.clean( [ m[1] ] );
+
+ // HANDLE: $(expr)
+ else
+ return new jQuery( c ).find( a );
}
+
+ return this.setArray(
+ // HANDLE: $(array)
+ a.constructor == Array && a ||
- // Watch for when an array is passed in
- return this.setArray( a.constructor == Array || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType ?
- // Assume that it is an array of DOM Elements
- jQuery.makeArray( a ) :
+ // HANDLE: $(arraylike)
+ // Watch for when an array-like object is passed as the selector
+ (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||
- // Find the matching elements and save them for later
- jQuery.find( a, c ) );
+ // HANDLE: $(*)
+ [ a ] );
};
// Map over the $ in case of overwrite