Fixed a bug with $("body") in dynamic documents, refactored $(...), stopped the test suite from trying to run Ajax tests locally.
This commit is contained in:
parent
5acecf6e28
commit
12e6335339
|
@ -1,5 +1,7 @@
|
||||||
module("ajax");
|
module("ajax");
|
||||||
|
|
||||||
|
if ( location.protocol != "file:" ) {
|
||||||
|
|
||||||
test("serialize()", function() {
|
test("serialize()", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
var data = $(':input').not('button').serialize();
|
var data = $(':input').not('button').serialize();
|
||||||
|
@ -376,3 +378,5 @@ test("evalScripts() with no script elements", function() {
|
||||||
}
|
}
|
||||||
ok ( true, 'after evalScripts()');
|
ok ( true, 'after evalScripts()');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
26
src/jquery/coreTest.js
vendored
26
src/jquery/coreTest.js
vendored
|
@ -107,19 +107,21 @@ test("attr(String, Object)", function() {
|
||||||
ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );
|
ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("attr(String, Object)x", function() {
|
if ( location.protocol != "file:" ) {
|
||||||
expect(2);
|
test("attr(String, Object)x", function() {
|
||||||
stop();
|
expect(2);
|
||||||
$.get('data/dashboard.xml', function(xml) {
|
stop();
|
||||||
var titles = [];
|
$.get('data/dashboard.xml', function(xml) {
|
||||||
$('tab', xml).each(function() {
|
var titles = [];
|
||||||
titles.push($(this).attr('title'));
|
$('tab', xml).each(function() {
|
||||||
});
|
titles.push($(this).attr('title'));
|
||||||
ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );
|
});
|
||||||
ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );
|
ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );
|
||||||
start();
|
ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );
|
||||||
|
start();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
test("css(String|Hash)", function() {
|
test("css(String|Hash)", function() {
|
||||||
expect(8);
|
expect(8);
|
||||||
|
|
48
src/jquery/jquery.js
vendored
48
src/jquery/jquery.js
vendored
|
@ -23,39 +23,41 @@ window.undefined = window.undefined;
|
||||||
* @cat Core
|
* @cat Core
|
||||||
*/
|
*/
|
||||||
var jQuery = function(a,c) {
|
var jQuery = function(a,c) {
|
||||||
// Make sure that a selection was provided
|
|
||||||
a = a || document;
|
|
||||||
|
|
||||||
// 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 the context is global, return a new object
|
||||||
if ( window == this )
|
if ( window == this )
|
||||||
return new jQuery(a,c);
|
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 new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
|
||||||
|
|
||||||
// Handle HTML strings
|
// Handle HTML strings
|
||||||
if ( typeof a == "string" ) {
|
if ( typeof a == "string" ) {
|
||||||
|
// HANDLE: $(html) -> $(array)
|
||||||
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
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
|
// HANDLE: $(arraylike)
|
||||||
return this.setArray( a.constructor == Array || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType ?
|
// Watch for when an array-like object is passed as the selector
|
||||||
// Assume that it is an array of DOM Elements
|
(a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||
|
||||||
jQuery.makeArray( a ) :
|
|
||||||
|
|
||||||
// Find the matching elements and save them for later
|
// HANDLE: $(*)
|
||||||
jQuery.find( a, c ) );
|
[ a ] );
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map over the $ in case of overwrite
|
// Map over the $ in case of overwrite
|
||||||
|
|
|
@ -214,10 +214,6 @@ jQuery.extend({
|
||||||
ret = r = oid &&
|
ret = r = oid &&
|
||||||
(!m[3] || oid.nodeName == m[3].toUpperCase()) ? [oid] : [];
|
(!m[3] || oid.nodeName == m[3].toUpperCase()) ? [oid] : [];
|
||||||
|
|
||||||
// Use the DOM 0 shortcut for the body element
|
|
||||||
} else if ( m[1] == "" && m[2] == "body" ) {
|
|
||||||
ret = r = [ document.body ];
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Pre-compile a regular expression to handle class searches
|
// Pre-compile a regular expression to handle class searches
|
||||||
if ( m[1] == "." )
|
if ( m[1] == "." )
|
||||||
|
|
Loading…
Reference in a new issue