1 import { document } from "../var/document.js";
2 import { documentElement } from "../var/documentElement.js";
3 import { support } from "../var/support.js";
7 var reliableTrDimensionsVal,
8 div = document.createElement( "div" );
10 // Finish early in limited (non-browser) environments
15 // Support: IE 10 - 11+
16 // IE misreports `getComputedStyle` of table rows with width/height
17 // set in CSS while `offset*` properties report correct values.
18 // Support: Firefox 70+
19 // Only Firefox includes border widths
20 // in computed dimensions. (gh-4529)
21 support.reliableTrDimensions = function() {
22 var table, tr, trStyle;
23 if ( reliableTrDimensionsVal == null ) {
24 table = document.createElement( "table" );
25 tr = document.createElement( "tr" );
27 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
28 tr.style.cssText = "box-sizing:content-box;border:1px solid";
30 // Support: Chrome 86+
31 // Height set through cssText does not get applied.
32 // Computed height then comes back as 0.
33 tr.style.height = "1px";
34 div.style.height = "9px";
36 // Support: Android Chrome 86+
37 // In our bodyBackground.html iframe,
38 // display for all div elements is set to "inline",
39 // which causes a problem only in Android Chrome, but
40 // not consistently across all devices.
41 // Ensuring the div is `display: block`
42 // gets around this issue.
43 div.style.display = "block";
50 // Don't run until window is visible
51 if ( table.offsetWidth === 0 ) {
52 documentElement.removeChild( table );
56 trStyle = window.getComputedStyle( tr );
57 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
58 parseInt( trStyle.borderTopWidth, 10 ) +
59 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
61 documentElement.removeChild( table );
63 return reliableTrDimensionsVal;