diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2017-08-06 20:43:24 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2017-08-06 20:43:24 -0500 |
commit | f7045b862a5b7c3de8ee2ea3da67616b38a667cc (patch) | |
tree | 504f420546df4934495bbd6f3d9761650b3783bd /lib/jquery/src/css/support.js | |
download | ytlibre-f7045b862a5b7c3de8ee2ea3da67616b38a667cc.tar.lz ytlibre-f7045b862a5b7c3de8ee2ea3da67616b38a667cc.tar.xz ytlibre-f7045b862a5b7c3de8ee2ea3da67616b38a667cc.zip |
first commit
Diffstat (limited to 'lib/jquery/src/css/support.js')
-rw-r--r-- | lib/jquery/src/css/support.js | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/jquery/src/css/support.js b/lib/jquery/src/css/support.js new file mode 100644 index 0000000..883d0e5 --- /dev/null +++ b/lib/jquery/src/css/support.js @@ -0,0 +1,89 @@ +define( [ + "../core", + "../var/document", + "../var/documentElement", + "../var/support" +], function( jQuery, document, documentElement, support ) { + +"use strict"; + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + +return support; + +} ); |