So after my first stab at my first jQuery plugin I found a pretty big bug right away. First we should take a look at the core of the problem and how this works. When your using jQuery to select something from the DOM you can pass in an optional argument. This argument is the context in which you want to search. This will give us some obvious performance benefits because we don't have to drill down the entire node, we can just search the node we are in.
I did not think about it at first but the code as constructed is going to cause some problems. With this markup it will work fine. But what happens if there are any other list elemnents in the sub menus? This of course is going to come up so we have a problem on our hands.
With that problem I started looking for a solution. Because I didn't really know how to accomplish this i was trying all kinds of selectors and traversing methods all of which came up short. Finally someone on the jQuery forums was able to help me out. We want only direct decedents of the object we are working with. I knew about this but what I did not know was that you could start off with it. Because we are starting off with the context of the object we are working with we can say only direct list items of the obj,ul.

#1 by Eric Hynds on 2/15/10 - 8:14 AM
#2 by Ben Nadel on 2/15/10 - 9:20 AM
$('> ul > li',obj);
... is the same as:
obj.find( "> ul > li" );
I typically go with find() purely because I think it reads a bit nicer; just though I would throw that out there.