On 8/13/06, Sam wrote:

The node id node_3_children satisfies the criteria $('#tree .node
.nodeChildren') once for nodeID node_1, and once again for nodeID node_3.
The problem here is #tree .node .nodeChildren allows any number of elements
to appear between these attributes:  e.g., there may be 3 <div
class="node">, all of class .node, between #tree .node and .nodeChildren.
If you want to specify direct descendents only, you could try $$('#tree >
.node > .nodeChildren'), but I don't know if $$ supports direct descendents.
 It probably does, but I've never had the opportunity to test.  In my
experience, nothing works until you see it  work.

Sam,

I think his point is that he wants a unique list from $$. It doesn't
matter if there are ten ways to get to the same element, it should be
checking to make sure an item is NOT already in the list before
pushing it onto the list.

You'd find it very frustrating if getElementsByTagName() returned the
same element more than once in the result list. That's because you
usually want to *do* something with the items in the list, and you
don't want to process any of them more than once.

If getElementsByTagName() did return some elements more than once, and
the browser vendors explained that the reason is because of how they
build the list, we'd all be quite disgusted. In this case, knowing WHY
$$ returns the same element twice doesn't matter... that's not what we
expect the function to do.

Looks like a bug to me, Brian.

Seth
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to