Hi Added this small plugin (673 bytes) that lets you namespace jQuery methods. You can use claim only one name ofjQuery.fn, and have multiple sub- functions under that name. This is one possible approach to keep the rule of only claiming one name from the jQuery namespace.
You declare this: $.fn.foo = function(){ ... }; $.fn.foo.bar = function(){ ... }; $.fn.foo.baz = function(){ ... }; And use it like this: $(...).foo().bar( ... ); $(...).foo( .... ); $(...).foo().baz( ... ).foo().bar( ... ).foo( ... ); The plugin is code in such a way, that no closure is formed, and there're no references to variables on other scope. Making this super garbage-collection friendly. It can be used for plugins, to access helper functions, or execute commands on the base call. Something like this was requested before, a few times, these are the last 2: http://groups.google.com/group/jquery-en/browse_thread/thread/95c88db9c89fb802 http://groups.google.com/group/jquery-en/browse_thread/thread/c19ffee3d784aa8a It's another approach for the command pattern, or the event pattern: http://groups.google.com/group/jquery-en/browse_thread/thread/3c6a35bbb7ff7e82 It can also be useful for people that structure their code into modules/plugins, even though they aren't actually doing real plugins. Here's the homepage: http://flesler.blogspot.com/2008/04/jquerymodularize.html It has documentation, an example, and a link to the demo. Any feedback/bug reporting is much appreciated. Peace -- Ariel Flesler http://flesler.blogspot.com