aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/var/getStyles.js
blob: 7adbdcfb5125d961289b0a241d1f6782c97b4ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
define( function() {
	"use strict";

	return 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 );
	};
} );