Check if an element or its ancestors have a specific class.
Element to check
Class name to look for
True if element or any ancestor has the class
Check if an element or its ancestors have a specific class.