add test case exercising checking that element !== document prior to matching