Recursive .children(a, b) instead of .children(a).children(b)

Recursive .children(a, b) instead of .children(a).children(b)

I would like to suggest extending the functionality of a .children method (and other traversing methods where applicable) to accept variable length parameters set.

Currently I use my own extension method which does the job:

  1. jQuery.fn.extend(
  2. {
  3.     childrenCascade: function()
  4.     {
  5.         var result = this;
  6.         for (var i = 0; i < arguments.length; i++)
  7.         {
  8.             result = result.children(arguments[i]);
  9.         }
  10.         return result;
  11.     }
  12. }

It would be nice to have such an option using pure jquery. Simple to implement, handy and intuitive (at least I hope so :-) ). Unless there is a nicer way to do that... ?