mirror of
https://github.com/jquery/jquery.git
synced 2026-02-02 21:15:09 -05:00
Core: Support non-browser environments
Fixes gh-2133
Fixes gh-2501
Closes gh-2504
Refs gh-1950
Refs gh-1949
Refs gh-2397
Refs gh-1537
Refs gh-2504
Refs 842958e7ae
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
define([
|
||||
"exports",
|
||||
"../core",
|
||||
"../var/documentElement",
|
||||
"./var/rnumnonpx",
|
||||
"./var/rmargin",
|
||||
"./support",
|
||||
"../selector" // contains
|
||||
], function( exports, jQuery, rnumnonpx, rmargin, support ) {
|
||||
], function( exports, jQuery, documentElement, rnumnonpx, rmargin, support ) {
|
||||
|
||||
var getStyles, curCSS,
|
||||
rposition = /^(top|right|bottom|left)$/;
|
||||
@@ -68,7 +69,7 @@ if ( window.getComputedStyle ) {
|
||||
ret :
|
||||
ret + "";
|
||||
};
|
||||
} else if ( document.documentElement.currentStyle ) {
|
||||
} else if ( documentElement.currentStyle ) {
|
||||
getStyles = function( elem ) {
|
||||
return elem.currentStyle;
|
||||
};
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
define([
|
||||
"../core",
|
||||
"../var/document",
|
||||
"../var/documentElement",
|
||||
"../var/support"
|
||||
], function( jQuery, support ) {
|
||||
], function( jQuery, document, documentElement, support ) {
|
||||
|
||||
(function() {
|
||||
var div, container, style, a, pixelPositionVal, boxSizingReliableVal, gBCRDimensionsVal,
|
||||
pixelMarginRightVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
|
||||
|
||||
// Setup
|
||||
div = document.createElement( "div" );
|
||||
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
||||
a = div.getElementsByTagName( "a" )[ 0 ];
|
||||
style = a && a.style;
|
||||
var pixelPositionVal, boxSizingReliableVal, gBCRDimensionsVal,
|
||||
pixelMarginRightVal, reliableHiddenOffsetsVal, reliableMarginRightVal,
|
||||
container = document.createElement( "div" ),
|
||||
div = document.createElement( "div" );
|
||||
|
||||
// Finish early in limited (non-browser) environments
|
||||
if ( !style ) {
|
||||
if ( !div.style ) {
|
||||
return;
|
||||
}
|
||||
|
||||
style.cssText = "float:left;opacity:.5";
|
||||
div.style.cssText = "float:left;opacity:.5";
|
||||
|
||||
// Support: IE<9
|
||||
// Make sure that element opacity exists (as opposed to filter)
|
||||
support.opacity = style.opacity === "0.5";
|
||||
support.opacity = div.style.opacity === "0.5";
|
||||
|
||||
// Verify style float existence
|
||||
// (IE uses styleFloat instead of cssFloat)
|
||||
support.cssFloat = !!style.cssFloat;
|
||||
support.cssFloat = !!div.style.cssFloat;
|
||||
|
||||
div.style.backgroundClip = "content-box";
|
||||
div.cloneNode( true ).style.backgroundClip = "";
|
||||
|
||||
Reference in New Issue
Block a user