diff options
author | Thomas Tortorini <thomastortorini@gmail.com> | 2015-06-14 23:58:44 +0200 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2015-06-25 02:48:35 +0200 |
commit | 3a0d582cf63b6e8f77150d9c38d2bf34d0c7790e (patch) | |
tree | 920b177b2be121445162075e6e25e6808ebdfdc9 /src/css/var | |
parent | 5153b5334eb2c8317372b46209bd9d092a91afdc (diff) | |
download | jquery-3a0d582cf63b6e8f77150d9c38d2bf34d0c7790e.tar.gz jquery-3a0d582cf63b6e8f77150d9c38d2bf34d0c7790e.zip |
CSS: make the getStyles function more readable
The new version is not only simpler to read but also smaller
by 6 bytes gzipped.
Closes gh-2393
Diffstat (limited to 'src/css/var')
-rw-r--r-- | src/css/var/getStyles.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/css/var/getStyles.js b/src/css/var/getStyles.js index 0d1d51af6..31dfc298e 100644 --- a/src/css/var/getStyles.js +++ b/src/css/var/getStyles.js @@ -1,12 +1,15 @@ define(function() { return 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 ); + var view = elem.ownerDocument.defaultView; + + if ( !view.opener ) { + view = window; } - return window.getComputedStyle( elem ); + return view.getComputedStyle( elem ); }; }); |