"../core",
"./var/rnumnonpx",
"./var/rmargin",
+ "./support",
"../selector" // contains
-], function( exports, jQuery, rnumnonpx, rmargin ) {
+], function( exports, jQuery, rnumnonpx, rmargin, support ) {
var getStyles, curCSS,
rposition = /^(top|right|bottom|left)$/;
ret = jQuery.style( elem, name );
}
- // Support: Android 4.0-4.3
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
- if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+ if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
], function( jQuery, support ) {
(function() {
- // Minified: var b,c,d,e,f,g, h,i
- var div, style, a, pixelPositionVal, boxSizingReliableVal,
+ var div, container, style, a, pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal,
reliableHiddenOffsetsVal, reliableMarginRightVal;
// Setup
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
+ container = document.createElement( "div" );
+ container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
+ "padding:0;margin-top:1px;position:absolute";
+ div.innerHTML = "";
+ container.appendChild( div );
+
jQuery.extend(support, {
reliableHiddenOffsets: function() {
- if ( reliableHiddenOffsetsVal == null ) {
+ if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableHiddenOffsetsVal;
},
boxSizingReliable: function() {
- if ( boxSizingReliableVal == null ) {
+ // We're checking for pixelPositionVal here instead of boxSizingReliableVal
+ // since that compresses better and they're computed together anyway.
+ if ( pixelPositionVal == null ) {
computeStyleTests();
}
return boxSizingReliableVal;
},
+ pixelMarginRight: function() {
+ // Support: Android 4.0-4.3
+ if ( pixelPositionVal == null ) {
+ computeStyleTests();
+ }
+ return pixelMarginRightVal;
+ },
+
pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
return pixelPositionVal;
},
- // Support: Android 2.3
reliableMarginRight: function() {
- if ( reliableMarginRightVal == null ) {
+ // Support: Android 2.3
+ if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginRightVal;
});
function computeStyleTests() {
- // Minified: var b,c,d,j
- var div, container, contents,
+ var contents, divStyle,
body = document.body;
if ( !body || !body.style ) {
}
// Setup
- div = document.createElement( "div" );
- container = document.createElement( "div" );
- container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
- body.appendChild( container ).appendChild( div );
+ body.appendChild( container );
div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;box-sizing:border-box;" +
- "display:block;margin-top:1%;top:1%;" +
- "border:1px;padding:1px;width:4px;position:absolute";
+ "position:absolute;display:block;" +
+ "margin:0;margin-top:1%;margin-right:50%;" +
+ "border:1px;padding:1px;" +
+ "top:1%;height:4px;width:50%";
// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
// Check for getComputedStyle so that this code is not run in IE<9.
if ( window.getComputedStyle ) {
- pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
- boxSizingReliableVal =
- ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+ divStyle = window.getComputedStyle( div, null );
+ pixelPositionVal = ( divStyle || {} ).top !== "1%";
+ boxSizingReliableVal = ( divStyle || { height: "4px" } ).height === "4px";
+ pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
// Support: Android 2.3
// Div with explicit width and no margin-right incorrectly
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
}
+ // Teardown
body.removeChild( container );
}
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": true,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": false,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": false,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": true,
"radioValue": false,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": false,
"ownLast": true,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": false,
"reliableHiddenOffsets": false,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": true,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": true,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": false,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,
"optDisabled": false,
"optSelected": true,
"ownLast": false,
+ "pixelMarginRight": true,
"pixelPosition": false,
"radioValue": true,
"reliableHiddenOffsets": true,