From 436d2369951a133ea9563a1cf1fcb2980a6a76dd Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 14 Mar 2014 17:20:17 +0000 Subject: [PATCH 1/2] jQuery: closest --- jquery/jquery.d.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 58a672d42..92e95b308 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -3329,10 +3329,32 @@ interface JQuery { */ children(selector?: string): JQuery; - closest(selector: string): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ closest(selector: string, context?: Element): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param obj A jQuery object to match elements against. + */ closest(obj: JQuery): JQuery; - closest(element: any): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param element An element to match elements against. + */ + closest(element: Element): JQuery; + + /** + * Get an array of all the elements and selectors matched against the current element up through the DOM tree. + * + * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ closest(selectors: any, context?: Element): any[]; contents(): JQuery; From 3fd61644e2eb480eb56181bd685e37c2a20719dc Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 14 Mar 2014 17:26:43 +0000 Subject: [PATCH 2/2] jQuery: added overload --- jquery/jquery.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 92e95b308..93cb0b999 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -3329,6 +3329,12 @@ interface JQuery { */ children(selector?: string): JQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + */ + closest(selector: string): JQuery; /** * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. *