mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Core: Implement .even() & .odd() to replace POS :even & :odd
`:even` & `:odd` are deprecated since jQuery 3.4.0 & will be removed in 4.0.0.
The new `even()` & `odd()` methods will make the migration easier.
Closes gh-4485
(cherry picked from commit 78420d427c)
This commit is contained in:
committed by
Michał Gołębiowski-Owczarek
parent
0c67da4b74
commit
409cbda7fe
@@ -670,6 +670,18 @@ QUnit.test( "first()/last()", function( assert ) {
|
||||
assert.deepEqual( $none.last().get(), [], "last() none" );
|
||||
} );
|
||||
|
||||
QUnit.test( "even()/odd()", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
|
||||
var $links = jQuery( "#ap a" ), $none = jQuery( "asdf" );
|
||||
|
||||
assert.deepEqual( $links.even().get(), q( "google", "anchor1" ), "even()" );
|
||||
assert.deepEqual( $links.odd().get(), q( "groups", "mark" ), "odd()" );
|
||||
|
||||
assert.deepEqual( $none.even().get(), [], "even() none" );
|
||||
assert.deepEqual( $none.odd().get(), [], "odd() none" );
|
||||
} );
|
||||
|
||||
QUnit.test( "map()", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user