Build: Bump the github-actions group with 2 updates
[jquery.git] / src / css / support.js
blob93459c6b69203a07a7b98058eec7cdd59b8495ad
1 import { document } from "../var/document.js";
2 import { documentElement } from "../var/documentElement.js";
3 import { support } from "../var/support.js";
5 ( function() {
7 var reliableTrDimensionsVal,
8 div = document.createElement( "div" );
10 // Finish early in limited (non-browser) environments
11 if ( !div.style ) {
12 return;
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";
45 documentElement
46 .appendChild( table )
47 .appendChild( tr )
48 .appendChild( div );
50 // Don't run until window is visible
51 if ( table.offsetWidth === 0 ) {
52 documentElement.removeChild( table );
53 return;
56 trStyle = window.getComputedStyle( tr );
57 reliableTrDimensionsVal = ( Math.round( parseFloat( trStyle.height ) ) +
58 Math.round( parseFloat( trStyle.borderTopWidth ) ) +
59 Math.round( parseFloat( trStyle.borderBottomWidth ) ) ) === tr.offsetHeight;
61 documentElement.removeChild( table );
63 return reliableTrDimensionsVal;
65 } )();
67 export { support };