// Easy API for creating new setFilters
function setFilters() {}
-setFilters.prototype = Expr.filters = Expr.pseudos;
+setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
jQuery.find = find;
-// Deprecated
-jQuery.expr[ ":" ] = jQuery.expr.pseudos;
-jQuery.unique = jQuery.uniqueSort;
-
// These have always been private, but they used to be documented as part of
// Sizzle so let's maintain them for now for backwards compatibility purposes.
find.compile = compile;
} );
}
+if ( includesModule( "selector" ) ) {
+ QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ](
+ "jQuery.expr[ \":\" ], jQuery.expr.filters",
+ function( assert ) {
+ assert.expect( 2 );
+
+ assert.strictEqual( jQuery.expr[ ":" ], jQuery.expr.pseudos,
+ "jQuery.expr[ \":\" ] is an alias of jQuery.expr.pseudos" );
+ assert.strictEqual( jQuery.expr.filters, jQuery.expr.pseudos,
+ "jQuery.expr.filters is an alias of jQuery.expr.pseudos" );
+ } );
+}
+
+QUnit.test( "jQuery.unique", function( assert ) {
+ assert.expect( 1 );
+
+ assert.strictEqual( jQuery.unique, jQuery.uniqueSort,
+ "jQuery.unique is an alias of jQuery.uniqueSort" );
+} );
+
}
assert.expect( 6 );
try {
- jQuery.expr.filters.foundation = jQuery.expr.filters.root;
+ jQuery.expr.pseudos.foundation = jQuery.expr.pseudos.root;
assert.deepEqual( jQuery.find( ":foundation" ), [ document.documentElement ], "Copy element filter with new name" );
} finally {
- delete jQuery.expr.filters.foundation;
+ delete jQuery.expr.pseudos.foundation;
}
try {
}
try {
- jQuery.expr.filters.aristotlean = jQuery.expr.createPseudo( function() {
+ jQuery.expr.pseudos.aristotlean = jQuery.expr.createPseudo( function() {
return function( elem ) {
return !!elem.id;
};
} );
assert.t( "Custom element filter", "#foo :aristotlean", [ "sndp", "en", "yahoo", "sap", "anchor2", "timmy" ] );
} finally {
- delete jQuery.expr.filters.aristotlean;
+ delete jQuery.expr.pseudos.aristotlean;
}
try {
- jQuery.expr.filters.endswith = jQuery.expr.createPseudo( function( text ) {
+ jQuery.expr.pseudos.endswith = jQuery.expr.createPseudo( function( text ) {
return function( elem ) {
return jQuery.text( elem ).slice( -text.length ) === text;
};
} );
assert.t( "Custom element filter with argument", "a:endswith(ogle)", [ "google" ] );
} finally {
- delete jQuery.expr.filters.endswith;
+ delete jQuery.expr.pseudos.endswith;
}
try {
} );
assert.t( "Custom set filter", "#qunit-fixture p:second", [ "ap" ] );
} finally {
- delete jQuery.expr.filters.second;
+ delete jQuery.expr.setFilters.second;
}
try {
} );
assert.t( "Custom set filter with argument", "#qunit-fixture p:slice(1:3)", [ "ap", "sndp" ] );
} finally {
- delete jQuery.expr.filters.slice;
+ delete jQuery.expr.setFilters.slice;
}
} );
assert.expect( 3 );
try {
- jQuery.expr.filters.icontains = function( elem, i, match ) {
+ jQuery.expr.pseudos.icontains = function( elem, i, match ) {
return jQuery.text( elem ).toLowerCase().indexOf( ( match[ 3 ] || "" ).toLowerCase() ) > -1;
};
assert.t( "Custom element filter with argument", "a:icontains(THIS BLOG ENTRY)", [ "john1" ] );
} finally {
- delete jQuery.expr.filters.icontains;
+ delete jQuery.expr.pseudos.icontains;
}
try {