mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #10814. Make support tests lazy and broken out to components.
This commit is contained in:
parent
776012b8b3
commit
bbbdd94725
@ -42,7 +42,7 @@ module.exports = function( grunt ) {
|
|||||||
ajax: [ "manipulation/_evalUrl" ],
|
ajax: [ "manipulation/_evalUrl" ],
|
||||||
callbacks: [ "deferred" ],
|
callbacks: [ "deferred" ],
|
||||||
css: [ "effects", "dimensions", "offset" ],
|
css: [ "effects", "dimensions", "offset" ],
|
||||||
sizzle: [ "css/hidden-visible-selectors", "effects/animated-selector" ]
|
sizzle: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -88,13 +88,12 @@ Some example modules that can be excluded are:
|
|||||||
- **exports/amd**: Exclude the AMD definition.
|
- **exports/amd**: Exclude the AMD definition.
|
||||||
- **core/ready**: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with `jQuery()` will simply be called immediately. However, `jQuery(document).ready()` will not be a function and `.on("ready", ...)` or similar will not be triggered.
|
- **core/ready**: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with `jQuery()` will simply be called immediately. However, `jQuery(document).ready()` will not be a function and `.on("ready", ...)` or similar will not be triggered.
|
||||||
- **deferred**: Exclude jQuery.Deferred. This also removes jQuery.Callbacks. *Note* that modules that depend on jQuery.Deferred(AJAX, effects, core/ready) will not be removed and will still expect jQuery.Deferred to be there. Include your own jQuery.Deferred implementation or exclude those modules as well (`grunt custom:-deferred,-ajax,-effects,-core/ready`).
|
- **deferred**: Exclude jQuery.Deferred. This also removes jQuery.Callbacks. *Note* that modules that depend on jQuery.Deferred(AJAX, effects, core/ready) will not be removed and will still expect jQuery.Deferred to be there. Include your own jQuery.Deferred implementation or exclude those modules as well (`grunt custom:-deferred,-ajax,-effects,-core/ready`).
|
||||||
- **support**: Excluding the support module is not recommended, but possible. It's your responsibility to either remove modules that use jQuery.support (many of them) or replace the values wherever jQuery.support is used. This is mainly only useful when building a barebones version of jQuery.
|
|
||||||
|
|
||||||
As a special case, you may also replace Sizzle by using a special flag `grunt custom:-sizzle`.
|
As a special case, you may also replace Sizzle by using a special flag `grunt custom:-sizzle`.
|
||||||
|
|
||||||
- **sizzle**: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.
|
- **sizzle**: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.
|
||||||
|
|
||||||
*Note*: Excluding Sizzle will also exclude all jQuery selector extensions (such as `effects/animated-selector` and `css/hidden-visible-selectors`).
|
*Note*: Excluding Sizzle will also exclude all jQuery selector extensions (such as `effects/animatedSelector` and `css/hiddenVisibleSelectors`).
|
||||||
|
|
||||||
The build process shows a message for each dependent module it excludes or includes.
|
The build process shows a message for each dependent module it excludes or includes.
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
"../core",
|
"../core",
|
||||||
"../ajax",
|
"../var/support",
|
||||||
"../support"
|
"../ajax"
|
||||||
], function( jQuery ) {
|
], function( jQuery, support ) {
|
||||||
|
|
||||||
jQuery.ajaxSettings.xhr = function() {
|
jQuery.ajaxSettings.xhr = function() {
|
||||||
try {
|
try {
|
||||||
@ -33,13 +33,13 @@ if ( window.ActiveXObject ) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
||||||
jQuery.support.ajax = xhrSupported = !!xhrSupported;
|
support.ajax = xhrSupported = !!xhrSupported;
|
||||||
|
|
||||||
jQuery.ajaxTransport(function( options ) {
|
jQuery.ajaxTransport(function( options ) {
|
||||||
var callback;
|
var callback;
|
||||||
// Cross domain only allowed if supported through XMLHttpRequest
|
// Cross domain only allowed if supported through XMLHttpRequest
|
||||||
if ( jQuery.support.cors || xhrSupported && !options.crossDomain ) {
|
if ( support.cors || xhrSupported && !options.crossDomain ) {
|
||||||
return {
|
return {
|
||||||
send: function( headers, complete ) {
|
send: function( headers, complete ) {
|
||||||
var i, id,
|
var i, id,
|
||||||
|
@ -2,9 +2,9 @@ define([
|
|||||||
"../core",
|
"../core",
|
||||||
"../var/rnotwhite",
|
"../var/rnotwhite",
|
||||||
"../var/strundefined",
|
"../var/strundefined",
|
||||||
"../selector",
|
"./support",
|
||||||
"../support"
|
"../selector"
|
||||||
], function( jQuery, rnotwhite, strundefined ) {
|
], function( jQuery, rnotwhite, strundefined, support ) {
|
||||||
|
|
||||||
var nodeHook, boolHook,
|
var nodeHook, boolHook,
|
||||||
attrHandle = jQuery.expr.attrHandle;
|
attrHandle = jQuery.expr.attrHandle;
|
||||||
@ -93,7 +93,8 @@ jQuery.extend({
|
|||||||
attrHooks: {
|
attrHooks: {
|
||||||
type: {
|
type: {
|
||||||
set: function( elem, value ) {
|
set: function( elem, value ) {
|
||||||
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
|
if ( !support.radioValue && value === "radio" &&
|
||||||
|
jQuery.nodeName( elem, "input" ) ) {
|
||||||
// Setting the type on a radio button after the value resets the value in IE6-9
|
// Setting the type on a radio button after the value resets the value in IE6-9
|
||||||
// Reset value to default in case type is set after value during creation
|
// Reset value to default in case type is set after value during creation
|
||||||
var val = elem.value;
|
var val = elem.value;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
"../core",
|
"../core",
|
||||||
"../support"
|
"./support"
|
||||||
], function( jQuery ) {
|
], function( jQuery, support ) {
|
||||||
|
|
||||||
var rfocusable = /^(?:input|select|textarea|button)$/i;
|
var rfocusable = /^(?:input|select|textarea|button)$/i;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ jQuery.extend({
|
|||||||
|
|
||||||
// Support: IE9+
|
// Support: IE9+
|
||||||
// Selectedness for an option in an optgroup can be inaccurate
|
// Selectedness for an option in an optgroup can be inaccurate
|
||||||
if ( !jQuery.support.optSelected ) {
|
if ( !support.optSelected ) {
|
||||||
jQuery.propHooks.selected = {
|
jQuery.propHooks.selected = {
|
||||||
get: function( elem ) {
|
get: function( elem ) {
|
||||||
var parent = elem.parentNode;
|
var parent = elem.parentNode;
|
||||||
|
35
src/attributes/support.js
Normal file
35
src/attributes/support.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
define([
|
||||||
|
"../var/support"
|
||||||
|
], function( support ) {
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var input = document.createElement( "input" ),
|
||||||
|
select = document.createElement( "select" ),
|
||||||
|
opt = select.appendChild( document.createElement( "option" ) );
|
||||||
|
|
||||||
|
input.type = "checkbox";
|
||||||
|
|
||||||
|
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
|
||||||
|
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
|
||||||
|
support.checkOn = input.value !== "";
|
||||||
|
|
||||||
|
// Must access the parent to make an option select properly
|
||||||
|
// Support: IE9, IE10
|
||||||
|
support.optSelected = opt.selected;
|
||||||
|
|
||||||
|
// Make sure that the options inside disabled selects aren't marked as disabled
|
||||||
|
// (WebKit marks them as disabled)
|
||||||
|
select.disabled = true;
|
||||||
|
support.optDisabled = !opt.disabled;
|
||||||
|
|
||||||
|
// Check if an input maintains its value after becoming a radio
|
||||||
|
// Support: IE9, IE10
|
||||||
|
input = document.createElement( "input" );
|
||||||
|
input.value = "t";
|
||||||
|
input.type = "radio";
|
||||||
|
support.radioValue = input.value === "t";
|
||||||
|
})();
|
||||||
|
|
||||||
|
return support;
|
||||||
|
|
||||||
|
});
|
@ -1,7 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
"../core",
|
"../core",
|
||||||
"../support"
|
"./support"
|
||||||
], function( jQuery ) {
|
], function( jQuery, support ) {
|
||||||
|
|
||||||
var rreturn = /\r/g;
|
var rreturn = /\r/g;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ jQuery.extend({
|
|||||||
// IE6-9 doesn't update selected after form reset (#2551)
|
// IE6-9 doesn't update selected after form reset (#2551)
|
||||||
if ( ( option.selected || i === index ) &&
|
if ( ( option.selected || i === index ) &&
|
||||||
// Don't return options that are disabled or in a disabled optgroup
|
// Don't return options that are disabled or in a disabled optgroup
|
||||||
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
|
||||||
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
||||||
|
|
||||||
// Get the specific value for the option
|
// Get the specific value for the option
|
||||||
@ -146,7 +146,7 @@ jQuery.each([ "radio", "checkbox" ], function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if ( !jQuery.support.checkOn ) {
|
if ( support.checkOn ) {
|
||||||
jQuery.valHooks[ this ].get = function( elem ) {
|
jQuery.valHooks[ this ].get = function( elem ) {
|
||||||
// Support: Webkit
|
// Support: Webkit
|
||||||
// "" is returned instead of "on" if a value isn't specified
|
// "" is returned instead of "on" if a value isn't specified
|
||||||
|
11
src/core.js
11
src/core.js
@ -9,9 +9,10 @@ define([
|
|||||||
"./var/class2type",
|
"./var/class2type",
|
||||||
"./var/toString",
|
"./var/toString",
|
||||||
"./var/hasOwn",
|
"./var/hasOwn",
|
||||||
"./var/trim"
|
"./var/trim",
|
||||||
|
"./var/support"
|
||||||
], function( strundefined, arr, slice, concat, push, indexOf,
|
], function( strundefined, arr, slice, concat, push, indexOf,
|
||||||
class2type, toString, hasOwn, trim ) {
|
class2type, toString, hasOwn, trim, support ) {
|
||||||
|
|
||||||
var
|
var
|
||||||
// A central reference to the root jQuery(document)
|
// A central reference to the root jQuery(document)
|
||||||
@ -702,7 +703,11 @@ jQuery.extend({
|
|||||||
length ? fn( elems[0], key ) : emptyGet;
|
length ? fn( elems[0], key ) : emptyGet;
|
||||||
},
|
},
|
||||||
|
|
||||||
now: Date.now
|
now: Date.now,
|
||||||
|
|
||||||
|
// jQuery.support is not used in Core but other projects attach their
|
||||||
|
// properties to it so it needs to exist.
|
||||||
|
support: support
|
||||||
});
|
});
|
||||||
|
|
||||||
// Populate the class2type map
|
// Populate the class2type map
|
||||||
|
86
src/css.js
86
src/css.js
@ -3,15 +3,15 @@ define([
|
|||||||
"./var/pnum",
|
"./var/pnum",
|
||||||
"./css/var/cssExpand",
|
"./css/var/cssExpand",
|
||||||
"./css/var/isHidden",
|
"./css/var/isHidden",
|
||||||
|
"./css/support",
|
||||||
"./css/defaultDisplay",
|
"./css/defaultDisplay",
|
||||||
"./data/var/data_priv",
|
"./data/var/data_priv",
|
||||||
"./core/swap",
|
"./css/swap",
|
||||||
"./core/ready",
|
"./core/ready",
|
||||||
"./selector", // contains
|
"./selector", // contains
|
||||||
"./support",
|
|
||||||
// Optional
|
// Optional
|
||||||
"./offset"
|
"./offset"
|
||||||
], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, data_priv ) {
|
], function( jQuery, pnum, cssExpand, isHidden, support, defaultDisplay, data_priv ) {
|
||||||
var curCSS,
|
var curCSS,
|
||||||
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
|
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
|
||||||
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
||||||
@ -233,7 +233,7 @@ jQuery.extend({
|
|||||||
|
|
||||||
// Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
|
// Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
|
||||||
// but it would mean to define eight (for every problematic property) identical functions
|
// but it would mean to define eight (for every problematic property) identical functions
|
||||||
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
|
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
|
||||||
style[ name ] = "inherit";
|
style[ name ] = "inherit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ function getWidthOrHeight( elem, name, extra ) {
|
|||||||
var valueIsBorderBox = true,
|
var valueIsBorderBox = true,
|
||||||
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
||||||
styles = getStyles( elem ),
|
styles = getStyles( elem ),
|
||||||
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
||||||
|
|
||||||
// some non-html elements return undefined for offsetWidth, so check for null/undefined
|
// some non-html elements return undefined for offsetWidth, so check for null/undefined
|
||||||
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
||||||
@ -401,7 +401,8 @@ function getWidthOrHeight( elem, name, extra ) {
|
|||||||
|
|
||||||
// we need the check for style in case a browser which returns unreliable values
|
// we need the check for style in case a browser which returns unreliable values
|
||||||
// for getComputedStyle silently falls back to the reliable elem.style
|
// for getComputedStyle silently falls back to the reliable elem.style
|
||||||
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
|
valueIsBorderBox = isBorderBox &&
|
||||||
|
( support.boxSizingReliable() || val === elem.style[ name ] );
|
||||||
|
|
||||||
// Normalize "", auto, and prepare for extra
|
// Normalize "", auto, and prepare for extra
|
||||||
val = parseFloat( val ) || 0;
|
val = parseFloat( val ) || 0;
|
||||||
@ -440,7 +441,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
|
|||||||
elem,
|
elem,
|
||||||
name,
|
name,
|
||||||
extra,
|
extra,
|
||||||
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
||||||
styles
|
styles
|
||||||
) : 0
|
) : 0
|
||||||
);
|
);
|
||||||
@ -448,42 +449,49 @@ jQuery.each([ "height", "width" ], function( i, name ) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// These hooks cannot be added until DOM ready because the support test
|
// Support: Android 2.3
|
||||||
// for it is not run until after DOM ready
|
jQuery.cssHooks.marginRight = {
|
||||||
jQuery(function() {
|
get: function( elem, computed ) {
|
||||||
// Support: Android 2.3
|
if ( support.reliableMarginRight() ) {
|
||||||
if ( !jQuery.support.reliableMarginRight ) {
|
// Hook not needed, remove it.
|
||||||
jQuery.cssHooks.marginRight = {
|
// Since there are no other hooks for marginRight, remove the whole object.
|
||||||
get: function( elem, computed ) {
|
delete jQuery.cssHooks.marginRight;
|
||||||
if ( computed ) {
|
return;
|
||||||
// Support: Android 2.3
|
}
|
||||||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
if ( computed ) {
|
||||||
// Work around by temporarily setting element display to inline-block
|
// Support: Android 2.3
|
||||||
return jQuery.swap( elem, { "display": "inline-block" },
|
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||||||
curCSS, [ elem, "marginRight" ] );
|
// Work around by temporarily setting element display to inline-block
|
||||||
}
|
return jQuery.swap( elem, { "display": "inline-block" },
|
||||||
}
|
curCSS, [ elem, "marginRight" ] );
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
||||||
// getComputedStyle returns percent when specified for top/left/bottom/right
|
// getComputedStyle returns percent when specified for top/left/bottom/right
|
||||||
// rather than make the css module depend on the offset module, we just check for it here
|
// rather than make the css module depend on the offset module, we just check for it here
|
||||||
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
|
jQuery.each( [ "top", "left" ], function( i, prop ) {
|
||||||
jQuery.each( [ "top", "left" ], function( i, prop ) {
|
jQuery.cssHooks[ prop ] = {
|
||||||
jQuery.cssHooks[ prop ] = {
|
get: function( elem, computed ) {
|
||||||
get: function( elem, computed ) {
|
if ( support.pixelPosition() || !jQuery.fn.position ) {
|
||||||
if ( computed ) {
|
// Hook not needed, remove it.
|
||||||
computed = curCSS( elem, prop );
|
// Since there are no other hooks for prop, remove the whole object.
|
||||||
// if curCSS returns percentage, fallback to offset
|
delete jQuery.cssHooks[ prop ];
|
||||||
return rnumnonpx.test( computed ) ?
|
return;
|
||||||
jQuery( elem ).position()[ prop ] + "px" :
|
}
|
||||||
computed;
|
jQuery.cssHooks[ prop ].get = function ( i, prop ) {
|
||||||
}
|
if ( computed ) {
|
||||||
|
computed = curCSS( elem, prop );
|
||||||
|
// if curCSS returns percentage, fallback to offset
|
||||||
|
return rnumnonpx.test( computed ) ?
|
||||||
|
jQuery( elem ).position()[ prop ] + "px" :
|
||||||
|
computed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
return jQuery.cssHooks[ prop ].get( i, prop );
|
||||||
}
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// These hooks are used by animate to expand properties
|
// These hooks are used by animate to expand properties
|
||||||
|
82
src/css/support.js
Normal file
82
src/css/support.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
define([
|
||||||
|
"../var/support"
|
||||||
|
], function( support ) {
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var pixelPositionVal, boxSizingReliableVal,
|
||||||
|
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
|
||||||
|
divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;" +
|
||||||
|
"-moz-box-sizing:content-box;box-sizing:content-box",
|
||||||
|
docElem = document.documentElement,
|
||||||
|
container = document.createElement( "div" ),
|
||||||
|
div = document.createElement( "div" );
|
||||||
|
|
||||||
|
div.style.backgroundClip = "content-box";
|
||||||
|
div.cloneNode( true ).style.backgroundClip = "";
|
||||||
|
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
||||||
|
|
||||||
|
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;" +
|
||||||
|
"margin-top:1px";
|
||||||
|
container.appendChild( div );
|
||||||
|
|
||||||
|
// Executing both pixelPosition & boxSizingReliable tests require only one layout
|
||||||
|
// so they're executed at the same time to save the second computation.
|
||||||
|
function computePixelPositionAndBoxSizingReliable() {
|
||||||
|
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
|
||||||
|
div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
|
||||||
|
"box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" +
|
||||||
|
"position:absolute;top:1%";
|
||||||
|
docElem.appendChild( container );
|
||||||
|
|
||||||
|
var divStyle = window.getComputedStyle( div, null );
|
||||||
|
pixelPositionVal = divStyle.top !== "1%";
|
||||||
|
boxSizingReliableVal = divStyle.width === "4px";
|
||||||
|
|
||||||
|
docElem.removeChild( container );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use window.getComputedStyle because jsdom on node.js will break without it.
|
||||||
|
if ( window.getComputedStyle ) {
|
||||||
|
jQuery.extend(support, {
|
||||||
|
pixelPosition: function() {
|
||||||
|
// This test is executed only once but we still do memoizing
|
||||||
|
// since we can use the boxSizingReliable pre-computing.
|
||||||
|
// No need to check if the test was already performed, though.
|
||||||
|
computePixelPositionAndBoxSizingReliable();
|
||||||
|
return pixelPositionVal;
|
||||||
|
},
|
||||||
|
boxSizingReliable: function() {
|
||||||
|
if ( boxSizingReliableVal == null ) {
|
||||||
|
computePixelPositionAndBoxSizingReliable();
|
||||||
|
}
|
||||||
|
return boxSizingReliableVal;
|
||||||
|
},
|
||||||
|
reliableMarginRight: function() {
|
||||||
|
// Support: Android 2.3
|
||||||
|
// Check if div with explicit width and no margin-right incorrectly
|
||||||
|
// gets computed margin-right based on width of container. (#3333)
|
||||||
|
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||||||
|
// This support function is only executed once so no memoizing is needed.
|
||||||
|
var ret,
|
||||||
|
marginDiv = div.appendChild( document.createElement( "div" ) );
|
||||||
|
marginDiv.style.cssText = div.style.cssText = divReset;
|
||||||
|
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
||||||
|
div.style.width = "1px";
|
||||||
|
docElem.appendChild( container );
|
||||||
|
|
||||||
|
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
|
||||||
|
|
||||||
|
docElem.removeChild( container );
|
||||||
|
|
||||||
|
// Clean up the div for other support tests.
|
||||||
|
div.innerHTML = "";
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
return support;
|
||||||
|
|
||||||
|
});
|
@ -3,8 +3,6 @@ define([
|
|||||||
], function( jQuery ) {
|
], function( jQuery ) {
|
||||||
|
|
||||||
// A method for quickly swapping in/out CSS properties to get correct calculations.
|
// A method for quickly swapping in/out CSS properties to get correct calculations.
|
||||||
// Note: this method belongs to the css module but it's needed here for the support module.
|
|
||||||
// If support gets modularized, this method should be moved back to the css module.
|
|
||||||
jQuery.swap = function( elem, options, callback, args ) {
|
jQuery.swap = function( elem, options, callback, args ) {
|
||||||
var ret, name,
|
var ret, name,
|
||||||
old = {};
|
old = {};
|
@ -4,11 +4,11 @@ define([
|
|||||||
"./var/rnotwhite",
|
"./var/rnotwhite",
|
||||||
"./var/hasOwn",
|
"./var/hasOwn",
|
||||||
"./var/slice",
|
"./var/slice",
|
||||||
|
"./event/support",
|
||||||
"./data/var/data_priv",
|
"./data/var/data_priv",
|
||||||
"./data/accepts",
|
"./data/accepts",
|
||||||
"./selector",
|
"./selector"
|
||||||
"./support"
|
], function( jQuery, strundefined, rnotwhite, hasOwn, slice, support, data_priv ) {
|
||||||
], function( jQuery, strundefined, rnotwhite, hasOwn, slice, data_priv ) {
|
|
||||||
|
|
||||||
var rkeyEvent = /^key/,
|
var rkeyEvent = /^key/,
|
||||||
rmouseEvent = /^(?:mouse|contextmenu)|click/,
|
rmouseEvent = /^(?:mouse|contextmenu)|click/,
|
||||||
@ -716,7 +716,8 @@ jQuery.each({
|
|||||||
|
|
||||||
// Create "bubbling" focus and blur events
|
// Create "bubbling" focus and blur events
|
||||||
// Support: Firefox, Chrome, Safari
|
// Support: Firefox, Chrome, Safari
|
||||||
if ( !jQuery.support.focusinBubbles ) {
|
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
|
||||||
|
if ( !support.focusinBubbles ) {
|
||||||
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
||||||
|
|
||||||
// Attach a single capturing handler while someone wants focusin/focusout
|
// Attach a single capturing handler while someone wants focusin/focusout
|
||||||
|
9
src/event/support.js
Normal file
9
src/event/support.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
define([
|
||||||
|
"../var/support"
|
||||||
|
], function( support ) {
|
||||||
|
|
||||||
|
support.focusinBubbles = "onfocusin" in window;
|
||||||
|
|
||||||
|
return support;
|
||||||
|
|
||||||
|
});
|
5
src/jquery.js
vendored
5
src/jquery.js
vendored
@ -5,7 +5,6 @@ define([
|
|||||||
"./callbacks",
|
"./callbacks",
|
||||||
"./deferred",
|
"./deferred",
|
||||||
"./core/ready",
|
"./core/ready",
|
||||||
"./support",
|
|
||||||
"./data",
|
"./data",
|
||||||
"./queue",
|
"./queue",
|
||||||
"./queue/delay",
|
"./queue/delay",
|
||||||
@ -16,7 +15,7 @@ define([
|
|||||||
"./manipulation/_evalUrl",
|
"./manipulation/_evalUrl",
|
||||||
"./wrap",
|
"./wrap",
|
||||||
"./css",
|
"./css",
|
||||||
"./css/hidden-visible-selectors",
|
"./css/hiddenVisibleSelectors",
|
||||||
"./serialize",
|
"./serialize",
|
||||||
"./ajax",
|
"./ajax",
|
||||||
"./ajax/xhr",
|
"./ajax/xhr",
|
||||||
@ -24,7 +23,7 @@ define([
|
|||||||
"./ajax/jsonp",
|
"./ajax/jsonp",
|
||||||
"./ajax/load",
|
"./ajax/load",
|
||||||
"./effects",
|
"./effects",
|
||||||
"./effects/animated-selector",
|
"./effects/animatedSelector",
|
||||||
"./offset",
|
"./offset",
|
||||||
"./dimensions",
|
"./dimensions",
|
||||||
"./deprecated",
|
"./deprecated",
|
||||||
|
@ -3,14 +3,14 @@ define([
|
|||||||
"./var/concat",
|
"./var/concat",
|
||||||
"./var/push",
|
"./var/push",
|
||||||
"./manipulation/var/rcheckableType",
|
"./manipulation/var/rcheckableType",
|
||||||
|
"./manipulation/support",
|
||||||
"./data/var/data_priv",
|
"./data/var/data_priv",
|
||||||
"./data/var/data_user",
|
"./data/var/data_user",
|
||||||
"./data/accepts",
|
"./data/accepts",
|
||||||
"./selector",
|
"./selector",
|
||||||
"./traversing",
|
"./traversing",
|
||||||
"./event",
|
"./event"
|
||||||
"./support"
|
], function( jQuery, concat, push, rcheckableType, support, data_priv, data_user ){
|
||||||
], function( jQuery, concat, push, rcheckableType, data_priv, data_user ){
|
|
||||||
|
|
||||||
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
|
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
|
||||||
rtagName = /<([\w:]+)/,
|
rtagName = /<([\w:]+)/,
|
||||||
@ -218,7 +218,8 @@ jQuery.fn.extend({
|
|||||||
isFunction = jQuery.isFunction( value );
|
isFunction = jQuery.isFunction( value );
|
||||||
|
|
||||||
// We can't cloneNode fragments that contain checked, in WebKit
|
// We can't cloneNode fragments that contain checked, in WebKit
|
||||||
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
|
if ( isFunction || !( l <= 1 || typeof value !== "string" || support.checkClone ||
|
||||||
|
!rchecked.test( value ) ) ) {
|
||||||
return this.each(function( index ) {
|
return this.each(function( index ) {
|
||||||
var self = set.eq( index );
|
var self = set.eq( index );
|
||||||
if ( isFunction ) {
|
if ( isFunction ) {
|
||||||
@ -324,7 +325,8 @@ jQuery.extend({
|
|||||||
|
|
||||||
// Support: IE >= 9
|
// Support: IE >= 9
|
||||||
// Fix Cloning issues
|
// Fix Cloning issues
|
||||||
if ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
|
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
|
||||||
|
!jQuery.isXMLDoc( elem ) ) {
|
||||||
|
|
||||||
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
||||||
destElements = getAll( clone );
|
destElements = getAll( clone );
|
||||||
|
29
src/manipulation/support.js
Normal file
29
src/manipulation/support.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
define([
|
||||||
|
"../var/support"
|
||||||
|
], function( support ){
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var input = document.createElement( "input" ),
|
||||||
|
fragment = document.createDocumentFragment();
|
||||||
|
|
||||||
|
input.type = "checkbox";
|
||||||
|
|
||||||
|
// Make sure checked status is properly cloned
|
||||||
|
// Support: IE9, IE10
|
||||||
|
input.checked = true;
|
||||||
|
support.noCloneChecked = input.cloneNode( true ).checked;
|
||||||
|
|
||||||
|
// #11217 - WebKit loses check when the name is after the checked attribute
|
||||||
|
input.setAttribute( "checked", "t" );
|
||||||
|
input.setAttribute( "name", "t" );
|
||||||
|
|
||||||
|
fragment.appendChild( input );
|
||||||
|
|
||||||
|
// Support: Safari 5.1, Android 4.x, Android 2.3
|
||||||
|
// old WebKit doesn't clone checked state correctly in fragments
|
||||||
|
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
||||||
|
})();
|
||||||
|
|
||||||
|
return support;
|
||||||
|
|
||||||
|
});
|
111
src/support.js
111
src/support.js
@ -1,111 +0,0 @@
|
|||||||
define([
|
|
||||||
"./core",
|
|
||||||
"./core/swap",
|
|
||||||
// This is listed as a dependency for build order, but it's still optional in builds
|
|
||||||
"./core/ready"
|
|
||||||
], function( jQuery ) {
|
|
||||||
|
|
||||||
jQuery.support = (function( support ) {
|
|
||||||
var container, marginDiv, divStyle,
|
|
||||||
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
|
|
||||||
divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
|
|
||||||
docElem = document.documentElement,
|
|
||||||
input = document.createElement("input"),
|
|
||||||
fragment = document.createDocumentFragment(),
|
|
||||||
div = document.createElement("div"),
|
|
||||||
select = document.createElement("select"),
|
|
||||||
opt = select.appendChild( document.createElement("option") );
|
|
||||||
|
|
||||||
// Finish early in limited environments
|
|
||||||
if ( !input.type ) {
|
|
||||||
return support;
|
|
||||||
}
|
|
||||||
|
|
||||||
input.type = "checkbox";
|
|
||||||
|
|
||||||
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
|
|
||||||
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
|
|
||||||
support.checkOn = input.value !== "";
|
|
||||||
|
|
||||||
// Must access the parent to make an option select properly
|
|
||||||
// Support: IE9, IE10
|
|
||||||
support.optSelected = opt.selected;
|
|
||||||
|
|
||||||
// This is hard-coded to true for compatibility reasons,
|
|
||||||
// all supported browsers passed the test.
|
|
||||||
support.boxSizing = true;
|
|
||||||
|
|
||||||
// Will be defined later
|
|
||||||
support.reliableMarginRight = true;
|
|
||||||
support.boxSizingReliable = true;
|
|
||||||
support.pixelPosition = false;
|
|
||||||
|
|
||||||
// Make sure checked status is properly cloned
|
|
||||||
// Support: IE9, IE10
|
|
||||||
input.checked = true;
|
|
||||||
support.noCloneChecked = input.cloneNode( true ).checked;
|
|
||||||
|
|
||||||
// Make sure that the options inside disabled selects aren't marked as disabled
|
|
||||||
// (WebKit marks them as disabled)
|
|
||||||
select.disabled = true;
|
|
||||||
support.optDisabled = !opt.disabled;
|
|
||||||
|
|
||||||
// Check if an input maintains its value after becoming a radio
|
|
||||||
// Support: IE9, IE10
|
|
||||||
input = document.createElement("input");
|
|
||||||
input.value = "t";
|
|
||||||
input.type = "radio";
|
|
||||||
support.radioValue = input.value === "t";
|
|
||||||
|
|
||||||
// #11217 - WebKit loses check when the name is after the checked attribute
|
|
||||||
input.setAttribute( "checked", "t" );
|
|
||||||
input.setAttribute( "name", "t" );
|
|
||||||
|
|
||||||
fragment.appendChild( input );
|
|
||||||
|
|
||||||
// Support: Safari 5.1, Android 4.x, Android 2.3
|
|
||||||
// old WebKit doesn't clone checked state correctly in fragments
|
|
||||||
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
|
||||||
|
|
||||||
// Support: Firefox, Chrome, Safari
|
|
||||||
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
|
|
||||||
support.focusinBubbles = "onfocusin" in window;
|
|
||||||
|
|
||||||
div.style.backgroundClip = "content-box";
|
|
||||||
div.cloneNode( true ).style.backgroundClip = "";
|
|
||||||
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
|
||||||
|
|
||||||
container = document.createElement("div");
|
|
||||||
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
|
|
||||||
|
|
||||||
// Check box-sizing and margin behavior.
|
|
||||||
docElem.appendChild( container ).appendChild( div );
|
|
||||||
div.innerHTML = "";
|
|
||||||
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
|
|
||||||
div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%";
|
|
||||||
|
|
||||||
// Use window.getComputedStyle because jsdom on node.js will break without it.
|
|
||||||
if ( window.getComputedStyle ) {
|
|
||||||
divStyle = window.getComputedStyle( div, null );
|
|
||||||
support.pixelPosition = ( divStyle || {} ).top !== "1%";
|
|
||||||
support.boxSizingReliable = ( divStyle || { width: "4px" } ).width === "4px";
|
|
||||||
|
|
||||||
// Support: Android 2.3
|
|
||||||
// Check if div with explicit width and no margin-right incorrectly
|
|
||||||
// gets computed margin-right based on width of container. (#3333)
|
|
||||||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
|
||||||
marginDiv = div.appendChild( document.createElement( "div" ) );
|
|
||||||
marginDiv.style.cssText = div.style.cssText = divReset;
|
|
||||||
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
|
||||||
div.style.width = "1px";
|
|
||||||
|
|
||||||
support.reliableMarginRight =
|
|
||||||
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
|
|
||||||
}
|
|
||||||
|
|
||||||
docElem.removeChild( container );
|
|
||||||
|
|
||||||
return support;
|
|
||||||
})( {} );
|
|
||||||
|
|
||||||
});
|
|
4
src/var/support.js
Normal file
4
src/var/support.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
define(function() {
|
||||||
|
// All support tests are defined in their respective modules.
|
||||||
|
return {};
|
||||||
|
});
|
@ -17,10 +17,7 @@
|
|||||||
<div id="test"></div>
|
<div id="test"></div>
|
||||||
<script src="../../jquery.js"></script>
|
<script src="../../jquery.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var testWidth = jQuery( "#test" ).css( 'width' );
|
window.parent.iframeCallback( jQuery( "#test" ).css( 'width' ) );
|
||||||
jQuery(function() {
|
|
||||||
window.parent.iframeCallback( testWidth );
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
/**
|
|
||||||
* we need to null out border-width, because it causes bug #3838
|
|
||||||
* and until we drop IE6, this test will fail in IE6 if we didn't
|
|
||||||
* special case this situation.
|
|
||||||
**/
|
|
||||||
border-width: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
1
test/data/jquery-1.9.1.ajax_xhr.min.js
vendored
1
test/data/jquery-1.9.1.ajax_xhr.min.js
vendored
File diff suppressed because one or more lines are too long
@ -18,11 +18,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<script src="../../jquery.js"></script>
|
<script src="../../jquery.js"></script>
|
||||||
|
<script src="getComputedSupport.js"></script>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
jQuery(function() {
|
window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ),
|
||||||
window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support );
|
getComputedSupport( jQuery.support ) );
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
zoom: 0.87;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script>
|
|
||||||
jQuery(function() {
|
|
||||||
window.parent.iframeCallback( jQuery.support.boxSizing );
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,3 +1,3 @@
|
|||||||
jQuery(function() {
|
jQuery(function() {
|
||||||
parent.iframeCallback( jQuery.support );
|
parent.iframeCallback( getComputedSupport( jQuery.support ) );
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<title>CSP Test Page</title>
|
<title>CSP Test Page</title>
|
||||||
<script src="../../jquery.js"></script>
|
<script src="../../jquery.js"></script>
|
||||||
<script src="csp.js"></script>
|
<script src="csp.js"></script>
|
||||||
|
<script src="getComputedSupport.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>CSP Test Page</p>
|
<p>CSP Test Page</p>
|
||||||
|
14
test/data/support/getComputedSupport.js
Normal file
14
test/data/support/getComputedSupport.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
function getComputedSupport( support ) {
|
||||||
|
var prop,
|
||||||
|
result = {};
|
||||||
|
|
||||||
|
for ( prop in support ) {
|
||||||
|
if ( typeof support[ prop ] === "function" ) {
|
||||||
|
result[ prop ] = support[ prop ]();
|
||||||
|
} else {
|
||||||
|
result[ prop ] = support[ prop ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function() {
|
|
||||||
window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks );
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background: url('../1x1.jpg');
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script>
|
|
||||||
window.parent.iframeCallback();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,7 +1,6 @@
|
|||||||
/* for testing opacity set in styles in IE */
|
/* for testing opacity set in styles in IE */
|
||||||
ol#empty {
|
ol#empty {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div#fx-tests h4 {
|
div#fx-tests h4 {
|
||||||
@ -35,7 +34,7 @@ div.autowidth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.autoopacity {
|
div.autoopacity {
|
||||||
opacity: auto;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.largewidth {
|
div.largewidth {
|
||||||
@ -46,10 +45,6 @@ div.largeheight {
|
|||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.largeopacity {
|
|
||||||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.medwidth {
|
div.medwidth {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
@ -60,7 +55,6 @@ div.medheight {
|
|||||||
|
|
||||||
div.medopacity {
|
div.medopacity {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.nowidth {
|
div.nowidth {
|
||||||
@ -73,7 +67,6 @@ div.noheight {
|
|||||||
|
|
||||||
div.noopacity {
|
div.noopacity {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.hidden {
|
div.hidden {
|
||||||
@ -132,9 +125,6 @@ div#show-tests * { display: none; }
|
|||||||
#nothiddendivchild.em { font-size: 2em; }
|
#nothiddendivchild.em { font-size: 2em; }
|
||||||
#nothiddendivchild.prct { font-size: 150%; }
|
#nothiddendivchild.prct { font-size: 150%; }
|
||||||
|
|
||||||
/* For testing type on vml in IE #7071 */
|
|
||||||
v\:oval { behavior:url(#default#VML); display:inline-block; }
|
|
||||||
|
|
||||||
/* 8099 changes to default styles are read correctly */
|
/* 8099 changes to default styles are read correctly */
|
||||||
tt { display: none; }
|
tt { display: none; }
|
||||||
sup { display: none; }
|
sup { display: none; }
|
||||||
@ -143,9 +133,6 @@ dfn { display: none; }
|
|||||||
/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */
|
/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */
|
||||||
body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }
|
body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }
|
||||||
|
|
||||||
/* #6652 REMOVE FILTER:ALPHA(OPACITY=100) AFTER ANIMATION */
|
|
||||||
#t6652 div { filter: alpha(opacity=50); }
|
|
||||||
|
|
||||||
/* #10501 */
|
/* #10501 */
|
||||||
section { background:#f0f; display:block; }
|
section { background:#f0f; display:block; }
|
||||||
|
|
||||||
|
@ -797,10 +797,13 @@ test("css('width') and css('height') should respect box-sizing, see #11004", fun
|
|||||||
equal( el_dis.css("height"), el_dis.css("height", el_dis.css("height")).css("height"), "css('height') is not respecting box-sizing for disconnected element, see #11004");
|
equal( el_dis.css("height"), el_dis.css("height", el_dis.css("height")).css("height"), "css('height') is not respecting box-sizing for disconnected element, see #11004");
|
||||||
});
|
});
|
||||||
|
|
||||||
testIframeWithCallback( "css('width') should works correctly before document ready", "css/cssWidthBeforeDocReady.html", function( cssWidthBeforeDocReady ) {
|
testIframeWithCallback( "css('width') should work correctly before document ready (#14084)",
|
||||||
expect( 1 );
|
"css/cssWidthBeforeDocReady.html",
|
||||||
strictEqual( cssWidthBeforeDocReady, "100px", "elem.css('width') works correctly before document ready" );
|
function( cssWidthBeforeDocReady ) {
|
||||||
});
|
expect( 1 );
|
||||||
|
strictEqual( cssWidthBeforeDocReady, "100px", "elem.css('width') works correctly before document ready" );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
|
test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
|
||||||
expect ( 2 );
|
expect ( 2 );
|
||||||
|
@ -448,21 +448,6 @@ test("setters with and without box-sizing:border-box", function(){
|
|||||||
equal( el.outerHeight( 129, true ).height(), expected + 5, "test border-box innerHeight(int, true) by roundtripping" );
|
equal( el.outerHeight( 129, true ).height(), expected + 5, "test border-box innerHeight(int, true) by roundtripping" );
|
||||||
});
|
});
|
||||||
|
|
||||||
testIframe( "dimensions/documentSmall", "window vs. small document", function( jQuery, window, document ) {
|
|
||||||
// this test is practically tautological, but there is a bug in IE8
|
|
||||||
// with no simple workaround, so this test exposes the bug and works around it
|
|
||||||
if ( document.body.offsetWidth >= document.documentElement.offsetWidth ) {
|
|
||||||
expect( 2 );
|
|
||||||
|
|
||||||
equal( jQuery( document ).height(), jQuery( window ).height(), "document height matches window height" );
|
|
||||||
equal( jQuery( document ).width(), jQuery( window ).width(), "document width matches window width" );
|
|
||||||
} else {
|
|
||||||
// all tests should have at least one assertion
|
|
||||||
expect( 1 );
|
|
||||||
ok( true, "skipping test (conditions not satisfied)" );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
testIframe( "dimensions/documentLarge", "window vs. large document", function( jQuery, window, document ) {
|
testIframe( "dimensions/documentLarge", "window vs. large document", function( jQuery, window, document ) {
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
|
@ -1796,15 +1796,9 @@ test( "Cloned, detached HTML5 elems (#10667,10670)", function() {
|
|||||||
// First clone
|
// First clone
|
||||||
$clone = $section.clone();
|
$clone = $section.clone();
|
||||||
|
|
||||||
// Infer that the test is being run in IE<=8
|
// This branch tests a known behaviour in modern browsers that should never fail.
|
||||||
if ( $clone[ 0 ].outerHTML && !jQuery.support.opacity ) {
|
// Included for expected test count symmetry (expecting 1)
|
||||||
// This branch tests cloning nodes by reading the outerHTML, used only in IE<=8
|
equal( $clone[ 0 ].nodeName, "SECTION", "detached clone nodeName matches 'SECTION'" );
|
||||||
equal( $clone[ 0 ].outerHTML, "<section></section>", "detached clone outerHTML matches '<section></section>'" );
|
|
||||||
} else {
|
|
||||||
// This branch tests a known behaviour in modern browsers that should never fail.
|
|
||||||
// Included for expected test count symmetry (expecting 1)
|
|
||||||
equal( $clone[ 0 ].nodeName, "SECTION", "detached clone nodeName matches 'SECTION' in modern browsers" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bind an event
|
// Bind an event
|
||||||
$section.on( "click", function() {
|
$section.on( "click", function() {
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
module("support", { teardown: moduleTeardown });
|
module("support", { teardown: moduleTeardown });
|
||||||
|
|
||||||
|
var computedSupport = getComputedSupport( jQuery.support );
|
||||||
|
|
||||||
|
function getComputedSupport( support ) {
|
||||||
|
var prop,
|
||||||
|
result = {};
|
||||||
|
|
||||||
|
for ( prop in support ) {
|
||||||
|
if ( typeof support[ prop ] === "function" ) {
|
||||||
|
result[ prop ] = support[ prop ]();
|
||||||
|
} else {
|
||||||
|
result[ prop ] = support[ prop ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if ( jQuery.css ) {
|
if ( jQuery.css ) {
|
||||||
testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
|
testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
@ -9,137 +26,109 @@ if ( jQuery.css ) {
|
|||||||
};
|
};
|
||||||
ok( okValue[ color ], "color was not reset (" + color + ")" );
|
ok( okValue[ color ], "color was not reset (" + color + ")" );
|
||||||
|
|
||||||
stop();
|
deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" );
|
||||||
// Run doc ready tests as well
|
|
||||||
jQuery(function() {
|
|
||||||
deepEqual( jQuery.extend( {}, support ), jQuery.support, "Same support properties" );
|
|
||||||
start();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
testIframeWithCallback( "A non-1 zoom on body doesn't cause WebKit to fail box-sizing test", "support/boxSizing.html", function( boxSizing ) {
|
|
||||||
expect( 1 );
|
|
||||||
equal( boxSizing, jQuery.support.boxSizing, "box-sizing properly detected on page with non-1 body zoom" );
|
|
||||||
});
|
|
||||||
|
|
||||||
testIframeWithCallback( "A background on the testElement does not cause IE8 to crash (#9823)", "support/testElementCrash.html", function() {
|
|
||||||
expect( 1 );
|
|
||||||
ok( true, "IE8 does not crash" );
|
|
||||||
});
|
|
||||||
|
|
||||||
testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlocks", "support/shrinkWrapBlocks.html", function( shrinkWrapBlocks ) {
|
|
||||||
expect( 1 );
|
|
||||||
strictEqual( shrinkWrapBlocks, jQuery.support.shrinkWrapBlocks, "jQuery.support.shrinkWrapBlocks properties are the same" );
|
|
||||||
});
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var expected, version,
|
var expected,
|
||||||
userAgent = window.navigator.userAgent;
|
userAgent = window.navigator.userAgent;
|
||||||
|
|
||||||
if ( /chrome/i.test( userAgent ) ) {
|
if ( /chrome/i.test( userAgent ) ) {
|
||||||
version = userAgent.match( /chrome\/(\d+)/i )[ 1 ];
|
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":true,
|
"ajax": true,
|
||||||
"optSelected":true,
|
|
||||||
"optDisabled":true,
|
|
||||||
"focusinBubbles":false,
|
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":true,
|
|
||||||
"radioValue":true,
|
|
||||||
"checkClone":true,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"boxSizing": true,
|
|
||||||
"boxSizingReliable": true,
|
"boxSizingReliable": true,
|
||||||
"pixelPosition": version >= 28
|
"checkClone": true,
|
||||||
|
"checkOn": true,
|
||||||
|
"clearCloneStyle": true,
|
||||||
|
"cors": true,
|
||||||
|
"focusinBubbles": false,
|
||||||
|
"noCloneChecked": true,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": true,
|
||||||
|
"pixelPosition": true,
|
||||||
|
"radioValue": true,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
|
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":true,
|
"ajax": true,
|
||||||
"optSelected":true,
|
|
||||||
"optDisabled":true,
|
|
||||||
"focusinBubbles":false,
|
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":true,
|
|
||||||
"radioValue":false,
|
|
||||||
"checkClone":true,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"boxSizing": true,
|
|
||||||
"boxSizingReliable": true,
|
"boxSizingReliable": true,
|
||||||
"pixelPosition": true
|
"checkClone": true,
|
||||||
|
"checkOn": true,
|
||||||
|
"clearCloneStyle": true,
|
||||||
|
"cors": true,
|
||||||
|
"focusinBubbles": false,
|
||||||
|
"noCloneChecked": true,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": true,
|
||||||
|
"pixelPosition": true,
|
||||||
|
"radioValue": false,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
} else if ( /msie 10\.0/i.test( userAgent ) ) {
|
} else if ( /msie 10\.0/i.test( userAgent ) ) {
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":true,
|
"ajax": true,
|
||||||
"optSelected":false,
|
|
||||||
"optDisabled":true,
|
|
||||||
"focusinBubbles":true,
|
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":false,
|
|
||||||
"radioValue":false,
|
|
||||||
"checkClone":true,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":true,
|
|
||||||
"clearCloneStyle": false,
|
|
||||||
"boxSizing": true,
|
|
||||||
"boxSizingReliable": false,
|
"boxSizingReliable": false,
|
||||||
"pixelPosition": true
|
"checkClone": true,
|
||||||
|
"checkOn": true,
|
||||||
|
"clearCloneStyle": false,
|
||||||
|
"cors": true,
|
||||||
|
"focusinBubbles": true,
|
||||||
|
"noCloneChecked": false,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": false,
|
||||||
|
"pixelPosition": true,
|
||||||
|
"radioValue": false,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
} else if ( /msie 9\.0/i.test( userAgent ) ) {
|
} else if ( /msie 9\.0/i.test( userAgent ) ) {
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":true,
|
"ajax": true,
|
||||||
"optSelected":false,
|
|
||||||
"optDisabled":true,
|
|
||||||
"focusinBubbles":true,
|
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":false,
|
|
||||||
"radioValue":false,
|
|
||||||
"checkClone":true,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":false,
|
|
||||||
"clearCloneStyle": false,
|
|
||||||
"boxSizing": true,
|
|
||||||
"boxSizingReliable": false,
|
"boxSizingReliable": false,
|
||||||
"pixelPosition": true
|
"checkClone": true,
|
||||||
|
"checkOn": true,
|
||||||
|
"clearCloneStyle": false,
|
||||||
|
"cors": false,
|
||||||
|
"focusinBubbles": true,
|
||||||
|
"noCloneChecked": false,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": false,
|
||||||
|
"pixelPosition": true,
|
||||||
|
"radioValue": false,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
} else if ( /5\.1\.\d+ safari/i.test( userAgent ) ) {
|
} else if ( /6\.0\.\d+ safari/i.test( userAgent ) ) {
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":false,
|
"ajax": true,
|
||||||
"optSelected":true,
|
|
||||||
"optDisabled":true,
|
|
||||||
"focusinBubbles":false,
|
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":true,
|
|
||||||
"radioValue":true,
|
|
||||||
"checkClone":false,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"boxSizing": true,
|
|
||||||
"boxSizingReliable": true,
|
"boxSizingReliable": true,
|
||||||
"pixelPosition": false
|
"checkClone": true,
|
||||||
|
"checkOn": true,
|
||||||
|
"clearCloneStyle": true,
|
||||||
|
"cors": true,
|
||||||
|
"focusinBubbles": false,
|
||||||
|
"noCloneChecked": true,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": true,
|
||||||
|
"pixelPosition": false,
|
||||||
|
"radioValue": true,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
} else if ( /firefox/i.test( userAgent ) ) {
|
} else if ( /firefox/i.test( userAgent ) ) {
|
||||||
version = userAgent.match( /firefox\/(\d+)/i )[ 1 ];
|
|
||||||
expected = {
|
expected = {
|
||||||
"checkOn":true,
|
"ajax": true,
|
||||||
"optSelected":true,
|
"boxSizingReliable": true,
|
||||||
"optDisabled":true,
|
"checkClone": true,
|
||||||
"focusinBubbles":false,
|
"checkOn": true,
|
||||||
"reliableMarginRight":true,
|
|
||||||
"noCloneChecked":true,
|
|
||||||
"radioValue":true,
|
|
||||||
"checkClone":true,
|
|
||||||
"ajax":true,
|
|
||||||
"cors":true,
|
|
||||||
"clearCloneStyle": true,
|
"clearCloneStyle": true,
|
||||||
"boxSizing": true,
|
"cors": true,
|
||||||
"boxSizingReliable": version >= 23,
|
"focusinBubbles": false,
|
||||||
"pixelPosition": true
|
"noCloneChecked": true,
|
||||||
|
"optDisabled": true,
|
||||||
|
"optSelected": true,
|
||||||
|
"pixelPosition": true,
|
||||||
|
"radioValue": true,
|
||||||
|
"reliableMarginRight": true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,17 +137,20 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
|
|||||||
var i, prop,
|
var i, prop,
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
for ( prop in jQuery.support ) {
|
for ( prop in computedSupport ) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect( j );
|
expect( j );
|
||||||
|
|
||||||
for ( i in expected ) {
|
for ( i in expected ) {
|
||||||
|
// TODO check for all modules containing support properties
|
||||||
if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) {
|
if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) {
|
||||||
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
|
equal( computedSupport[ i ], expected[ i ],
|
||||||
|
"jQuery.support['" + i + "']: " + computedSupport[ i ] +
|
||||||
|
", expected['" + i + "']: " + expected[ i ]);
|
||||||
} else {
|
} else {
|
||||||
ok( true, "no ajax; skipping jQuery.support['" + i + "']" );
|
ok( true, "no ajax; skipping jQuery.support[' " + i + " ']" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -166,13 +158,10 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
|
|||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Support: Safari 5.1
|
testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
|
||||||
// Shameless browser-sniff, but Safari 5.1 mishandles CSP
|
"support/csp.php",
|
||||||
if ( !( typeof navigator !== "undefined" &&
|
function( support ) {
|
||||||
(/ AppleWebKit\/\d.*? Version\/(\d+)/.exec(navigator.userAgent) || [])[1] < 6 ) ) {
|
|
||||||
|
|
||||||
testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions", "support/csp.php", function( support ) {
|
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
deepEqual( jQuery.extend( {}, support ), jQuery.support, "No violations of CSP polices" );
|
deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" );
|
||||||
});
|
}
|
||||||
}
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user