Blame view
app/bower_components/jquery/src/css/support.js
2.4 KB
|
87c93a029
|
1 |
define( [ |
|
f986e111b
|
2 |
"../core", |
|
87c93a029
|
3 4 |
"../var/document", "../var/documentElement", |
|
f986e111b
|
5 |
"../var/support" |
|
87c93a029
|
6 |
], function( jQuery, document, documentElement, support ) {
|
|
f986e111b
|
7 |
|
|
87c93a029
|
8 |
"use strict"; |
|
f986e111b
|
9 |
|
|
87c93a029
|
10 |
( function() {
|
|
f986e111b
|
11 |
|
|
87c93a029
|
12 13 14 |
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
|
|
f986e111b
|
15 |
|
|
87c93a029
|
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
// 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;
}
|
|
f986e111b
|
47 |
|
|
87c93a029
|
48 49 50 |
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, container = document.createElement( "div" ), div = document.createElement( "div" ); |
|
f986e111b
|
51 |
|
|
87c93a029
|
52 53 54 55 |
// Finish early in limited (non-browser) environments
if ( !div.style ) {
return;
}
|
|
f986e111b
|
56 |
|
|
87c93a029
|
57 58 |
// Support: IE <=9 - 11 only // Style of cloned element affects source element cloned (#8908) |
|
f986e111b
|
59 60 61 |
div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
|
87c93a029
|
62 63 64 |
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + "padding:0;margin-top:1px;position:absolute"; container.appendChild( div ); |
|
f986e111b
|
65 |
|
|
87c93a029
|
66 67 68 69 70 |
jQuery.extend( support, {
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
},
|
|
f986e111b
|
71 |
boxSizingReliable: function() {
|
|
87c93a029
|
72 |
computeStyleTests(); |
|
f986e111b
|
73 74 |
return boxSizingReliableVal; }, |
|
87c93a029
|
75 76 77 |
pixelMarginRight: function() {
computeStyleTests();
return pixelMarginRightVal;
|
|
f986e111b
|
78 |
}, |
|
87c93a029
|
79 80 81 |
reliableMarginLeft: function() {
computeStyleTests();
return reliableMarginLeftVal;
|
|
f986e111b
|
82 |
} |
|
87c93a029
|
83 84 |
} ); } )(); |
|
f986e111b
|
85 86 |
return support; |
|
87c93a029
|
87 |
} ); |