From c5d5f696b2a527f954b7e83fc290bd5bccdea008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82a=C5=BCejewicz=20=28Peter=20Blazejewicz=29?= Date: Sun, 21 Jun 2020 21:10:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#45618=20update(jqu?= =?UTF-8?q?ery):=20`even`/`odd`=20from=203.5=20by=20@peterblazejewicz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `even` method - `odd` method - version bump - tests amended https://github.com/jquery/jquery/commit/409cbda7fe85d7026aaa4423d3384f288eed5be2 https://api.jquery.com/even/ https://api.jquery.com/odd/ Thanks! --- types/jquery/JQuery.d.ts | 75 ++++++++++++++++++++++++++++++++++++ types/jquery/index.d.ts | 2 +- types/jquery/jquery-tests.ts | 8 ++++ 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/types/jquery/JQuery.d.ts b/types/jquery/JQuery.d.ts index 915a7b75c0..af509700a7 100644 --- a/types/jquery/JQuery.d.ts +++ b/types/jquery/JQuery.d.ts @@ -6167,6 +6167,81 @@ $( "p span" ).last().addClass( "highlight" ); ``` */ last(): this; + + /** + * Reduce the set of matched elements to the even ones in the set, numbered from zero. + * @see \`{@link https://api.jquery.com/even/ }\` + * @since 3.5 + * @example ​ ````Highlight the even items in a list. +```html + + + + + even demo + + + + + + + + + + + +``` + */ + even(): this; + + /** + * Reduce the set of matched elements to the odd ones in the set, numbered from zero. + * @see \`{@link https://api.jquery.com/odd/ }\` + * @since 3.5 + * @example ​ ````Highlight the odd items in a list. +```html + + + + + odd demo + + + + + + + + + + + +``` + */ + odd(): this; + /** * Load data from the server and place the returned HTML into the matched element. * @param url A string containing the URL to which the request is sent. diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index b42e8fb76c..cba9887578 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery 3.3 +// Type definitions for jquery 3.5 // Project: https://jquery.com // Definitions by: Leonard Thieu // Boris Yankov diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index a0ccb5d0e7..a9f9eb501a 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -5925,6 +5925,14 @@ function JQuery() { $('p').find('span').first(); } + function even() { + $('li').even().css('background-color', 'red'); + } + + function odd() { + $('li').odd().css('background-color', 'red'); + } + function offsetParent() { // $ExpectType JQuery $('p').offsetParent();