Merged my speed improvements into the jQuery core (is actually 200b smaller now!). Additionally, added in some better reporting to the test suite, and fixed a bug with how selector tests were performmed.
This commit is contained in:
parent
1b9f4d3d2e
commit
ec2b688920
3 changed files with 45 additions and 58 deletions
|
@ -172,17 +172,33 @@ function ok(a, msg) {
|
|||
function isSet(a, b, msg) {
|
||||
var ret = true;
|
||||
if ( a && b && a.length == b.length ) {
|
||||
for ( var i in a )
|
||||
for ( var i = 0; i < a.length; i++ )
|
||||
if ( a[i] != b[i] )
|
||||
ret = false;
|
||||
} else
|
||||
ret = false;
|
||||
if ( !ret )
|
||||
_config.Test.push( [ ret, msg + " expected: " + b + " result: " + a ] );
|
||||
_config.Test.push( [ ret, msg + " expected: " + serialArray(b) + " result: " + serialArray(a) ] );
|
||||
else
|
||||
_config.Test.push( [ ret, msg ] );
|
||||
}
|
||||
|
||||
function serialArray( a ) {
|
||||
var r = [];
|
||||
for ( var i = 0; i < a.length; i++ ) {
|
||||
var str = a[i].nodeName;
|
||||
if ( str ) {
|
||||
str = str.toLowerCase();
|
||||
if ( a[i].id )
|
||||
str += "#" + a[i].id;
|
||||
} else
|
||||
str = a[i];
|
||||
r.push( str );
|
||||
}
|
||||
|
||||
return "[ " + r.join(", ") + " ]"
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of elements with the given IDs, eg.
|
||||
* @example q("main", "foo", "bar")
|
||||
|
@ -201,7 +217,7 @@ function q() {
|
|||
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
|
||||
*/
|
||||
function t(a,b,c) {
|
||||
var f = jQuery.find(b);
|
||||
var f = jQuery(b);
|
||||
var s = "";
|
||||
for ( var i = 0; i < f.length; i++ )
|
||||
s += (s && ",") + '"' + f[i].id + '"';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue