From 3649e3320bf389e516c5707b18302a4e5cbc68c5 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Tue, 24 Dec 2013 11:31:23 +0000 Subject: [PATCH] jQuery: attr JSDoc --- jquery/jquery.d.ts | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 63ce53a96..3ddd0fefa 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -698,12 +698,40 @@ interface JQuery { */ addBack(selector?: string): JQuery; - + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + */ attr(attributeName: string): string; - attr(attributeName: string, value: any): JQuery; - attr(attributeName: string, func: (index: any, attr: any) => any): JQuery; - attr(map: any): JQuery; - + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. + */ + attr(attributeName: string, value: string): JQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. + */ + attr(attributeName: string, value: number): JQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. + */ + attr(attributeName: string, func: (index: number, attr: any) => any): JQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributes An object of attribute-value pairs to set. + */ + attr(attributes: Object): JQuery; + /** * Determine whether any of the matched elements are assigned the given class. *