Css: Don’t cache support.reliableMarginRight; thanks @jdalton, @timmywil

Fixes #14731
This commit is contained in:
Michał Gołębiowski 2014-01-26 02:07:35 +01:00
parent 41523ae1d3
commit 4cbb1a0063

View File

@ -5,7 +5,7 @@ define([
(function() { (function() {
var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal, var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal,
pixelPositionVal, reliableMarginRightVal, pixelPositionVal,
div = document.createElement( "div" ), div = document.createElement( "div" ),
containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px",
divReset = divReset =
@ -107,10 +107,10 @@ define([
}, },
reliableMarginRight: function() { reliableMarginRight: function() {
var body, container, div, marginDiv; var body, container, div, marginDiv, reliableMarginRightVal;
// Use window.getComputedStyle because jsdom on node.js will break without it. // Use window.getComputedStyle because jsdom on node.js will break without it.
if ( reliableMarginRightVal == null && window.getComputedStyle ) { if ( window.getComputedStyle ) {
body = document.getElementsByTagName( "body" )[ 0 ]; body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body ) { if ( !body ) {
// Test fired too early or in an unsupported environment, exit. // Test fired too early or in an unsupported environment, exit.
@ -136,9 +136,9 @@ define([
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
body.removeChild( container ); body.removeChild( container );
}
return reliableMarginRightVal; return reliableMarginRightVal;
}
} }
}); });
@ -171,7 +171,6 @@ define([
// Will be changed later if needed. // Will be changed later if needed.
boxSizingReliableVal = true; boxSizingReliableVal = true;
pixelPositionVal = false; pixelPositionVal = false;
reliableMarginRightVal = true;
// Use window.getComputedStyle because jsdom on node.js will break without it. // Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) { if ( window.getComputedStyle ) {