如何使用PHP Simple HTML DOM Parser查找具有特定子项的元素?

I need to find all tr that has a td child with a specific bgcolor.

Is it possible with PHP Simple HTML Dom Parser?

I can get all td with the next sentence:

$cells = $html->find ( "tr td[bgcolor=#3366FF]" );

But I need the tr instead of the td. I don't know if it is possible to find ascendant elements.

Thank you!

according to the documentation: http://simplehtmldom.sourceforge.net/manual_api.htm

parent() should work.

foreach($html->find('td[bgcolor=#3366FF]') as $element) {
    $element->parent() etc...

This should work to have tr...