CSS: Do not throw on frame elements in FF

IE9-10 throws on elements created in popups (see #14150), FF meanwhile throws
on frame elements through "defaultView.getComputedStyle" (see #15098)

Use "defaultView" if in the popup which would fix IE issue,
use "window.getComputedStyle" which would fix FF issue.

And everybody wins, except performance, but who cares right?

Fixes #15098
Ref e488d985cf
This commit is contained in:
Oleg Gaidarenko
2014-06-16 01:26:49 +04:00
parent d05f4bda1c
commit 76294e1e9e
2 changed files with 31 additions and 1 deletions

View File

@@ -11,7 +11,14 @@ var getStyles, curCSS,
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
// 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 );
};
curCSS = function( elem, name, computed ) {