Hi jQueryians,

as discussed before, the jQuery API contains quite a lot of methods. The event 
shortcuts or one thing, another is single methods with optional parameters. 
Let's take slideDown() as an example. It has two paremters, speed and callback. 
There is one method documented with only speed as a paremter, and one with both.

While it would be easy to merge the docs for these two, eg. add the example and 
slightly modify the text, there should be a useful mechanism to mark parameters 
as optional.

Some ideas:
@param Object speed (optional) A string repres..
@param [Object speed] A string repres..
@param Object (speed) A string repres..

The docs parser could parse this format, add an attribute to the json/xml file 
and the API stylesheets could then format the docs.

This should be only applied where applicable, like slideUp() etc., not to $().

There are other cases where a single methods accepts different types of a 
argument, like add() accepts a String, a Element or an Array of Elements. It 
actually does always the same, no matter what the argument is, only the 
actually executed code is somewhat different, but nothing a user has to worry 
about.

The good thing: Possible resulting changes affect only the documentation, no 
code at all!

Your opinions please!

--
Jörn Zaefferer

http://bassistance.de
-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to