Skip to content

Commit 11c93b9

Browse files
esxtjvantoll
authored andcommitted
All: Added structured types for higer order function parameters
Some function parameters of function type (e.g. handlers, callbacks) was described with the signature in the name-attribute, eg. <argument name="function(index, value)" type="Function">. This have been modified to used nested <argument>-elements to describe the signatures more consistently. Changed some argument type from XMLHttpRequest to jsXHR Some callback functions was indicated to receive XMLHttpRequest rather than jsXHR. Fixed spelling and changed 'ajaxOptions' to 'PlainObject' The ajaxOptions/ajaxSettings options object is not documented as a seperate type, so now changed to PlainObject. Changed misspelling of jsXHR to jqXHR. Changed nargument names to valid identifers to avoid confusion Argument names with whitespace like "jQuery object" are confusing, because it might easily be mistaken for two arguments when reading the signature. Argument names like "-index" are also confusing since they look like an expression rather than a name. I have renamed the argument names to be valid javascript identifiers, just like actual argument names have to be. Also changed argument type "Object" and "PlainObject" to "JQuery" where the prose documentation indicates that the type is a jQuery object. Changed argument name 'jQueryObject' to 'selection' As per discussion on #jquery-content. Also changed type from 'Object' to 'jQuery' where prose indicates a jQuery object. Closes jquerygh-419
1 parent a93a1cc commit 11c93b9

83 files changed

Lines changed: 357 additions & 129 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

entries/add.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</signature>
2222
<signature>
2323
<added>1.3.2</added>
24-
<argument name="jQuery object" type="jQuery">
24+
<argument name="selection" type="jQuery">
2525
<desc>An existing jQuery object to add to the set of matched elements.</desc>
2626
</argument>
2727
</signature>

entries/addClass.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
</signature>
1010
<signature>
1111
<added>1.4</added>
12-
<argument name="function(index, currentClass)" type="Function">
12+
<argument name="function" type="Function">
1313
<desc>A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, <code>this</code> refers to the current element in the set.</desc>
14+
<argument name="index" type="Integer" />
15+
<argument name="currentClassName" type="String" />
16+
<return type="String"/>
1417
</argument>
1518
</signature>
1619
<desc>Adds the specified class(es) to each of the set of matched elements.</desc>

entries/after.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020
</signature>
2121
<signature>
2222
<added>1.4</added>
23-
<argument name="function(index)" type="Function">
23+
<argument name="function" type="Function">
2424
<desc>A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, <code>this</code> refers to the current element in the set.</desc>
25+
<argument name="index" type="Integer" />
26+
<argument name="html" type="String" />
27+
<return>
28+
<type name="htmlString"/>
29+
<type name="Element"/>
30+
<type name="jQuery"/>
31+
</return>
2532
</argument>
2633
</signature>
2734
<desc>Insert content, specified by the parameter, after each element in the set of matched elements.</desc>

entries/ajaxComplete.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<title>.ajaxComplete()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="handler(event, XMLHttpRequest, ajaxOptions)" type="Function">
6+
<argument name="handler" type="Function">
7+
<argument name="event" type="Event" />
8+
<argument name="jqXHR" type="jqXHR" />
9+
<argument name="ajaxOptions" type="PlainObject" />
710
<desc>The function to be invoked.</desc>
811
</argument>
912
</signature>

entries/ajaxError.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
<title>.ajaxError()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="handler(event, jqXHR, ajaxSettings, thrownError)" type="Function">
6+
<argument name="handler" type="Function">
77
<desc>The function to be invoked.</desc>
8+
<argument name="event" type="Event" />
9+
<argument name="jqXHR" type="jqXHR" />
10+
<argument name="ajaxSettings" type="PlainObject" />
11+
<argument name="thrownError" type="String" />
812
</argument>
913
</signature>
1014
<desc>Register a handler to be called when Ajax requests complete with an error. This is an <a href="/Ajax_Events/">Ajax Event</a>.</desc>

entries/ajaxSend.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
<title>.ajaxSend()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="handler(event, jqXHR, ajaxOptions)" type="Function">
6+
<argument name="handler" type="Function">
77
<desc>The function to be invoked.</desc>
8+
<argument name="event" type="Event" />
9+
<argument name="jqXHR" type="jqXHR" />
10+
<argument name="ajaxOptions" type="PlainObject" />
811
</argument>
912
</signature>
1013
<desc>Attach a function to be executed before an Ajax request is sent. This is an <a href="/Ajax_Events/">Ajax Event</a>.</desc>

entries/ajaxStart.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<title>.ajaxStart()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="handler()" type="Function">
6+
<argument name="handler" type="Function">
77
<desc>The function to be invoked.</desc>
88
</argument>
99
</signature>

entries/ajaxStop.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<desc>Register a handler to be called when all Ajax requests have completed. This is an <a href="/Ajax_Events/">Ajax Event</a>.</desc>
55
<signature>
66
<added>1.0</added>
7-
<argument name="handler()" type="Function">
7+
<argument name="handler" type="Function">
88
<desc>The function to be invoked.</desc>
99
</argument>
1010
</signature>

entries/ajaxSuccess.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
<title>.ajaxSuccess()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="handler(event, XMLHttpRequest, ajaxOptions)" type="Function">
6+
<argument name="handler" type="Function">
77
<desc>The function to be invoked.</desc>
8+
<argument name="event" type="Event" />
9+
<argument name="jqXHR" type="jqXHR" />
10+
<argument name="ajaxOptions" type="PlainObject" />
11+
<argument name="data" type="PlainObject" />
812
</argument>
913
</signature>
1014
<desc>Attach a function to be executed whenever an Ajax request completes successfully. This is an <a href="/Ajax_Events/">Ajax Event</a>.</desc>

entries/append.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020
</signature>
2121
<signature>
2222
<added>1.4</added>
23-
<argument name="function(index, html)" type="Function">
23+
<argument name="function" type="Function">
2424
<desc>A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, <code>this</code> refers to the current element in the set.</desc>
25+
<argument name="index" type="Integer" />
26+
<argument name="html" type="String" />
27+
<return>
28+
<type name="htmlString"/>
29+
<type name="Element"/>
30+
<type name="jQuery"/>
31+
</return>
2532
</argument>
2633
</signature>
2734
<desc>Insert content, specified by the parameter, to the end of each element in the set of matched elements.</desc>

0 commit comments

Comments
 (0)