@Rob It is only true if the complexity of the DOM of those div is as simple as it is show in your test case. I have "complex-ized" the DOM and run the test, it does not show a big difference in 1000 run one, but a 10000 run show that the selector is faster than POJS.
So Adam, in conclusion, test it on your case! Nothing is always the best solution. WD On May 7, 10:36 am, RobG <rg...@iinet.net.au> wrote: > On May 7, 11:54 am, Ricardo <ricardob...@gmail.com> wrote: > > > > > > > On May 6, 10:23 am, Adam <flynn...@gmail.com> wrote: > > > > Essentially, I'd like to know if there is any difference between > > > > $("div.grandparent > div.parent > div.child") > > > > and > > > > $("div.grandparent").children("div.parent").children("div.child") > > > > Does anyone know which of these is more performant or preferred when > > > selecting child nodes? > > > > Thanks. > > > Best answer is a test: > > >http://jquery.nodnod.net/cases/353 > > > The overhead of multiple returns and function calls when using children > > () makes quite a difference. > > The overhead of such queries is even more significant if plain old > javascript (POJS) is also considered. That test page shows the CSS > selector takes half the time of children(), but a POJS vesion takes > between 1/3 and 1/5 the time of the selector. > > If performance matters, POJS wins. > > -- > Rob