mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 17:35:49 +08:00
jQuery: added data JSDoc + a little generic love
This commit is contained in:
@@ -889,6 +889,8 @@ function test_data() {
|
||||
jQuery.data(div, "test", { first: 16, last: "pizza!" });
|
||||
$("span:first").text(jQuery.data(div, "test").first);
|
||||
$("span:last").text(jQuery.data(div, "test").last);
|
||||
$.data(document.getElementById("id"), "", 8).toFixed(2);
|
||||
$.data(document.getElementById("id"), "", "8").toUpperCase();
|
||||
}
|
||||
|
||||
function test_dblclick() {
|
||||
|
||||
21
jquery/jquery.d.ts
vendored
21
jquery/jquery.d.ts
vendored
@@ -529,9 +529,26 @@ interface JQueryStatic {
|
||||
cssHooks: { [key: string]: any; };
|
||||
cssNumber: any;
|
||||
|
||||
// Data
|
||||
data(element: Element, key: string, value: any): any;
|
||||
/**
|
||||
* Store arbitrary data associated with the specified element. Returns the value that was set.
|
||||
*
|
||||
* @param element The DOM element to associate with the data.
|
||||
* @param key A string naming the piece of data to set.
|
||||
* @param value The new data value.
|
||||
*/
|
||||
data<T>(element: Element, key: string, value: T): T;
|
||||
/**
|
||||
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
|
||||
*
|
||||
* @param element The DOM element to associate with the data.
|
||||
* @param key A string naming the piece of data to set.
|
||||
*/
|
||||
data(element: Element, key: string): any;
|
||||
/**
|
||||
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
|
||||
*
|
||||
* @param element The DOM element to associate with the data.
|
||||
*/
|
||||
data(element: Element): any;
|
||||
|
||||
dequeue(element: Element, queueName?: string): any;
|
||||
|
||||
Reference in New Issue
Block a user