Merge pull request #16621 from mdvorscak/master

(jquery) Add JQueryCssProperties interface for $.css(properties: object)
This commit is contained in:
Yui
2017-06-15 07:43:57 -07:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -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.
+3
View File
@@ -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");
});