mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Merge pull request #16621 from mdvorscak/master
(jquery) Add JQueryCssProperties interface for $.css(properties: object)
This commit is contained in:
Vendored
+9
-1
@@ -699,6 +699,14 @@ interface JQueryCoordinates {
|
||||
top: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface used to specify the properties parameter in css()
|
||||
*/
|
||||
type cssPropertySetter = (index: number, value?: string) => string | number;
|
||||
interface JQueryCssProperties {
|
||||
[propertyName: string]: string | number | cssPropertySetter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Elements in the array returned by serializeArray()
|
||||
*/
|
||||
@@ -1707,7 +1715,7 @@ interface JQuery {
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/css/#css-properties}
|
||||
*/
|
||||
css(properties: Object): JQuery;
|
||||
css(properties: JQueryCssProperties): JQuery;
|
||||
|
||||
/**
|
||||
* Get the current computed height for the first element in the set of matched elements.
|
||||
|
||||
@@ -1065,6 +1065,9 @@ function test_css() {
|
||||
$('div.example').css('width', function (index) {
|
||||
return index * 50;
|
||||
});
|
||||
$('div.example').css('width', function (index, style) {
|
||||
return style.length > 0 ? style : index * 50;
|
||||
});
|
||||
$("p").mouseover(function () {
|
||||
$(this).css("color", "red");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user