Permalink
Browse files

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
  • Loading branch information...
mr21 authored and mgol committed Jun 14, 2015
1 parent 5153b53 commit 3a0d582cf63b6e8f77150d9c38d2bf34d0c7790e
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/css/var/getStyles.js
View
@@ -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 );
};
});

0 comments on commit 3a0d582

Please sign in to comment.