I'm using PHPQuery, which is a PHP port of jQuery, so it also uses CSS selectors. However, one difference is that PHPQuery does not return matched elements in the document order when there are multiple selectors.
Is it possible to combine this into one selector?
#article>p,#article>blockquote
The only other solution I can think of is:
#article>*:not(div):not(table):not(ul):not(...
I haven't used phpQuery(till 5 minutes ago) but as it works like jQuery, using it's .filter() method should do the trick, the idea is selecting all the children and then filtering the elements that match the criteria.
$doc['#article']->children()->filter(function($i, $element) {
return in_array($element->tagName, array('blockquote', 'p'));
})->foo();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With