2

I have a question about the dom crawler, or more specifically, the CssSelector Component. When I run

$descendants = $crawler->filter('ul > li');

on a multi dimensional list, I get all direct children. But when I run

$descendants = $crawler->filter('ul li');

I expect to get all descendants, but instead I get nothing. What am I doing wrong?

1
  • It think you can't get the descendants with the CssSelector component.
    – Wouter J
    Nov 11, 2012 at 19:31

1 Answer 1

0

Wouter J was right, it's not possible. But this is an acceptable workaround:

$descendants = $crawler->filter('ul')->filter('li');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.