jQuery: added data JSDoc + a little generic love

This commit is contained in:
John Reilly
2013-12-05 17:08:05 +00:00
parent 2a8d2ec77b
commit 44eb8f38a3
2 changed files with 21 additions and 2 deletions

View File

@@ -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
View File

@@ -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;