aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/var/getStyles.js
blob: d25af675268e60a68026a7f11accdbff4c3f22e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export default function( elem ) {

	// Support: IE <=11+ (trac-14150)
	// In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
	// break. Using `elem.ownerDocument.defaultView` avoids the issue.
	var view = elem.ownerDocument.defaultView;

	// `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView`
	// property; check `defaultView` truthiness to fallback to window in such a case.
	if ( !view ) {
		view = window;
	}

	return view.getComputedStyle( elem );
}