aboutsummaryrefslogtreecommitdiffstats
path: root/src/css/support.js
blob: dc18708c128c6a857c8ce2aaaf1bfb8d729017ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import document from "../var/document.js";
import documentElement from "../var/documentElement.js";
import support from "../var/support.js";

var reliableTrDimensionsVal;

// Support: IE 11+, Edge 15 - 18+
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
support.reliableTrDimensions = function() {
	var table, tr, trChild, trStyle;
	if ( reliableTrDimensionsVal == null ) {
		table = document.createElement( "table" );
		tr = document.createElement( "tr" );
		trChild = document.createElement( "div" );

		table.style.cssText = "position:absolute;left:-11111px";
		tr.style.height = "1px";
		trChild.style.height = "9px";

		documentElement
			.appendChild( table )
			.appendChild( tr )
			.appendChild( trChild );

		trStyle = window.getComputedStyle( tr );
		reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;

		documentElement.removeChild( table );
	}
	return reliableTrDimensionsVal;
};

export default support;