jQuery css in parent iframe (firefox)
Hi well I am trying to do a $(someElement).css("display"); someElement was returned from parent window and was passed to iframe via a function. This call in firefox returns undefined due to the following code in jQuery:
getStyles = function( elem ) {
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
if ( elem.ownerDocument.defaultView.opener ) {
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
}
return window.getComputedStyle( elem, null );
};
When in an iframe in firefox elem.ownerDocument.defaultView.opener is not set but elem.ownerDocument.defaultView.parent is. So I suggest replace it with
if ( elem.ownerDocument.defaultView.opener || elem.ownerDocument.defaultView.parent ) { ...