More accurate figcaption detection

Look at all ancestors not just immediate parent for presence of
figcaption element corresponding to an image element