I have an element inside an iframe, such as the body of the iframe, and from this element I need to access all the parents of the specific iframe which this element belongs to. There may be more than one iframe in the document and I need only the parents of the specific iframe, filtered by a selector (such as class name).
If the element would not have been inside an iframe, I could do just element.parents('.class-name');
. I need to check if this parent contains a specific descendant (filtered by a selector such as class name).
If the given element is not inside an iframe, just return its parents without any error message.