|
define( [ |
|
"../core", |
|
"../var/document", |
|
"../var/documentElement", |
|
"../var/support" |
|
], function( jQuery, document, documentElement, support ) { |
|
|
|
( function() { |
|
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, |
|
container = document.createElement( "div" ), |
|
div = document.createElement( "div" ); |
|
|
|
|
|
if ( !div.style ) { |
|
return; |
|
} |
|
|
|
|
|
|
|
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 ); |
|
|
|
|
|
|
|
function computeStyleTests() { |
|
div.style.cssText = |
|
|
|
|
|
|
|
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;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%"; |
|
reliableMarginLeftVal = divStyle.marginLeft === "2px"; |
|
boxSizingReliableVal = divStyle.width === "4px"; |
|
|
|
|
|
|
|
div.style.marginRight = "50%"; |
|
pixelMarginRightVal = divStyle.marginRight === "4px"; |
|
|
|
documentElement.removeChild( container ); |
|
} |
|
|
|
jQuery.extend( support, { |
|
pixelPosition: function() { |
|
|
|
|
|
|
|
|
|
computeStyleTests(); |
|
return pixelPositionVal; |
|
}, |
|
boxSizingReliable: function() { |
|
if ( boxSizingReliableVal == null ) { |
|
computeStyleTests(); |
|
} |
|
return boxSizingReliableVal; |
|
}, |
|
pixelMarginRight: function() { |
|
|
|
|
|
|
|
|
|
if ( boxSizingReliableVal == null ) { |
|
computeStyleTests(); |
|
} |
|
return pixelMarginRightVal; |
|
}, |
|
reliableMarginLeft: function() { |
|
|
|
|
|
if ( boxSizingReliableVal == null ) { |
|
computeStyleTests(); |
|
} |
|
return reliableMarginLeftVal; |
|
}, |
|
reliableMarginRight: function() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
var ret, |
|
marginDiv = div.appendChild( document.createElement( "div" ) ); |
|
|
|
|
|
marginDiv.style.cssText = div.style.cssText = |
|
|
|
|
|
|
|
"-webkit-box-sizing:content-box;box-sizing:content-box;" + |
|
"display:block;margin:0;border:0;padding:0"; |
|
marginDiv.style.marginRight = marginDiv.style.width = "0"; |
|
div.style.width = "1px"; |
|
documentElement.appendChild( container ); |
|
|
|
ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight ); |
|
|
|
documentElement.removeChild( container ); |
|
div.removeChild( marginDiv ); |
|
|
|
return ret; |
|
} |
|
} ); |
|
} )(); |
|
|
|
return support; |
|
|
|
} ); |
|
|