mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #45618 update(jquery): even/odd from 3.5 by @peterblazejewicz
- `even` method
- `odd` method
- version bump
- tests amended
409cbda7fe
https://api.jquery.com/even/
https://api.jquery.com/odd/
Thanks!
This commit is contained in:
parent
f03e9ce90a
commit
c5d5f696b2
75
types/jquery/JQuery.d.ts
vendored
75
types/jquery/JQuery.d.ts
vendored
@ -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
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>even demo</title>
|
||||
<style>
|
||||
.highlight {
|
||||
background-color: yellow;
|
||||
}
|
||||
</style>
|
||||
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<ul>
|
||||
<li>Look:</li>
|
||||
<li>This is some text in a list.</li>
|
||||
<li>This is a note about it.</li>
|
||||
<li>This is another note about it.</li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
$( "ul li" ).even().addClass( "highlight" );
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
*/
|
||||
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
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>odd demo</title>
|
||||
<style>
|
||||
.highlight {
|
||||
background-color: yellow;
|
||||
}
|
||||
</style>
|
||||
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<ul>
|
||||
<li>Look:</li>
|
||||
<li>This is some text in a list.</li>
|
||||
<li>This is a note about it.</li>
|
||||
<li>This is another note about it.</li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
$( "ul li" ).odd().addClass( "highlight" );
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
*/
|
||||
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.
|
||||
|
||||
2
types/jquery/index.d.ts
vendored
2
types/jquery/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for jquery 3.3
|
||||
// Type definitions for jquery 3.5
|
||||
// Project: https://jquery.com
|
||||
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Boris Yankov <https://github.com/borisyankov>
|
||||
|
||||
@ -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<HTMLElement>
|
||||
$('p').offsetParent();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user