Quick one - [] selector on existing collection

Quick one - [] selector on existing collection

Let's say $pages is a collection containing all div elements that have an id of page1 or page2

From this, I wish now to select now only the page div (i.e page1 or page2) that contains a descendant with a class of 'A'

Tried lots of things, just can't get the format right. Any help appreciated.