]> source.dussan.org Git - jquery.git/commitdiff
Fix #10814. Fix #14084. Make support tests lazy and broken out to components. 1353/head
authorMichał Gołębiowski <m.goleb@gmail.com>
Mon, 2 Sep 2013 17:21:09 +0000 (19:21 +0200)
committerMichał Gołębiowski <m.goleb@gmail.com>
Fri, 6 Sep 2013 01:40:49 +0000 (03:40 +0200)
38 files changed:
.jshintignore
README.md
src/ajax/xhr.js
src/attributes/attr.js
src/attributes/prop.js
src/attributes/support.js [new file with mode: 0644]
src/attributes/val.js
src/core.js
src/core/swap.js [deleted file]
src/css.js
src/css/hidden-visible-selectors.js [deleted file]
src/css/hiddenVisibleSelectors.js [new file with mode: 0644]
src/css/support.js [new file with mode: 0644]
src/css/swap.js [new file with mode: 0644]
src/data.js
src/data/support.js [new file with mode: 0644]
src/effects.js
src/effects/animated-selector.js [deleted file]
src/effects/animatedSelector.js [new file with mode: 0644]
src/effects/support.js [new file with mode: 0644]
src/event.js
src/event/support.js [new file with mode: 0644]
src/jquery.js
src/manipulation.js
src/manipulation/support.js [new file with mode: 0644]
src/support.js
src/traversing.js
src/var/support.js [new file with mode: 0644]
test/data/css/cssWidthBeforeDocReady.html [new file with mode: 0644]
test/data/support/bodyBackground.html
test/data/support/boxSizing.html
test/data/support/csp.js
test/data/support/csp.php
test/data/support/getComputedSupport.js [new file with mode: 0644]
test/data/support/shrinkWrapBlocks.html
test/unit/css.js
test/unit/effects.js
test/unit/support.js

index 6c1c7703762e51dc213b4f24bedf33c0f961efe8..894187dc1a18ef47a2854744182f8d2cb5ec23e8 100644 (file)
@@ -5,3 +5,5 @@ test/data/badjson.js
 test/data/json_obj.js
 test/data/readywaitasset.js
 test/data/readywaitloader.js
+test/data/support/csp.js
+test/data/support/getComputedSupport.js
index 65cb95d7feb4f36b91fdb03c364532fbc052ccd8..bf20e8d11bef65f6c028a864bb5841d1e151539c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -88,11 +88,10 @@ Some example modules that can be excluded are:
 - **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.
 - **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.
 
 Removing sizzle is not supported on the 1.x branch.
 
-*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.
 
index ab5bd5e1edcc13461560660e248231b3b8c49717..0217ce0f41855947b79aea1f23750ffc221d5f47 100644 (file)
@@ -1,8 +1,8 @@
 define([
        "../core",
-       "../ajax",
-       "../support"
-], function( jQuery ) {
+       "../var/support",
+       "../ajax"
+], function( jQuery, support ) {
 
 var xhrCallbacks, xhrSupported,
        xhrId = 0,
@@ -45,15 +45,15 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
 
 // Determine support properties
 xhrSupported = jQuery.ajaxSettings.xhr();
-jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
-xhrSupported = jQuery.support.ajax = !!xhrSupported;
+support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = support.ajax = !!xhrSupported;
 
 // Create transport if the browser can provide an xhr
 if ( xhrSupported ) {
 
        jQuery.ajaxTransport(function( s ) {
                // Cross domain only allowed if supported through XMLHttpRequest
-               if ( !s.crossDomain || jQuery.support.cors ) {
+               if ( !s.crossDomain || support.cors ) {
 
                        var callback;
 
index 6fb4d7f7fc9a75d585b1bd965241cbfa27be1fbb..916f64093e3369d458cd1a8ca6729b7d9e1fe78f 100644 (file)
@@ -2,16 +2,16 @@ define([
        "../core",
        "../var/rnotwhite",
        "../var/strundefined",
+       "./support",
        "./val",
-       "../selector",
-       "../support"
-], function( jQuery, rnotwhite, strundefined ) {
+       "../selector"
+], function( jQuery, rnotwhite, strundefined, support ) {
 
 var nodeHook, boolHook,
        attrHandle = jQuery.expr.attrHandle,
        ruseDefault = /^(?:checked|selected)$/i,
-       getSetAttribute = jQuery.support.getSetAttribute,
-       getSetInput = jQuery.support.input;
+       getSetAttribute = support.getSetAttribute,
+       getSetInput = support.input;
 
 jQuery.fn.extend({
        attr: function( name, value ) {
@@ -108,7 +108,7 @@ jQuery.extend({
        attrHooks: {
                type: {
                        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
                                        // Reset value to default in case type is set after value during creation
                                        var val = elem.value;
@@ -253,7 +253,7 @@ if ( !getSetAttribute ) {
        });
 }
 
-if ( !jQuery.support.style ) {
+if ( !support.style ) {
        jQuery.attrHooks.style = {
                get: function( elem ) {
                        // Return undefined in the case of empty string
index 490f2ef4a521ffde16c35c1f0682238aa95041ca..0acd62a2c73e88568b0ca2fe5da922ab069690f2 100644 (file)
@@ -1,7 +1,7 @@
 define([
        "../core",
-       "../support"
-], function( jQuery ) {
+       "./support"
+], function( jQuery, support ) {
 
 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
        rclickable = /^(?:a|area)$/i;
@@ -78,7 +78,7 @@ jQuery.extend({
 
 // Some attributes require a special call on IE
 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
-if ( !jQuery.support.hrefNormalized ) {
+if ( !support.hrefNormalized ) {
        // href/src property should get the full normalized URL (#10299/#12915)
        jQuery.each([ "href", "src" ], function( i, name ) {
                jQuery.propHooks[ name ] = {
@@ -92,7 +92,7 @@ if ( !jQuery.support.hrefNormalized ) {
 // Support: Safari, IE9+
 // mis-reports the default selected property of an option
 // Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
+if ( !support.optSelected ) {
        jQuery.propHooks.selected = {
                get: function( elem ) {
                        var parent = elem.parentNode;
@@ -126,7 +126,7 @@ jQuery.each([
 });
 
 // IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
+if ( !support.enctype ) {
        jQuery.propFix.enctype = "encoding";
 }
 
diff --git a/src/attributes/support.js b/src/attributes/support.js
new file mode 100644 (file)
index 0000000..5d4be1a
--- /dev/null
@@ -0,0 +1,63 @@
+define([
+       "../var/support"
+], function( support ) {
+
+(function () {
+       var a, input, select, opt,
+               div = document.createElement("div" );
+
+       // Setup
+       div.setAttribute( "className", "t" );
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+       a = div.getElementsByTagName("a")[ 0 ];
+
+       // First batch of tests.
+       select = document.createElement("select");
+       opt = select.appendChild( document.createElement("option") );
+       input = div.getElementsByTagName("input")[ 0 ];
+
+       a.style.cssText = "top:1px";
+
+       // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+       support.getSetAttribute = div.className !== "t";
+
+       // Get the style information from getAttribute
+       // (IE uses .cssText instead)
+       support.style = /top/.test( a.getAttribute("style") );
+
+       // Make sure that URLs aren't manipulated
+       // (IE normalizes it by default)
+       support.hrefNormalized = a.getAttribute("href") === "/a";
+
+       // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+       support.checkOn = !!input.value;
+
+       // Make sure that a selected-by-default option has a working selected property.
+       // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+       support.optSelected = opt.selected;
+
+       // Tests for enctype support on a form (#6743)
+       support.enctype = !!document.createElement("form").enctype;
+
+       // 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 we can trust getAttribute("value")
+       input = document.createElement("input");
+       input.setAttribute( "value", "" );
+       support.input = input.getAttribute( "value" ) === "";
+
+       // Check if an input maintains its value after becoming a radio
+       input.value = "t";
+       input.setAttribute( "type", "radio" );
+       support.radioValue = input.value === "t";
+
+       // Null elements to avoid leaks in IE.
+       a = input = select = opt = div = null;
+})();
+
+return support;
+
+});
index 074d23f8c090438663c526d1b025c4493003db81..e25249fb1e06fd39ff7cfc1d626da8bd4292264d 100644 (file)
@@ -1,7 +1,7 @@
 define([
        "../core",
-       "../support"
-], function( jQuery ) {
+       "./support"
+], function( jQuery, support ) {
 
 var rreturn = /\r/g;
 
@@ -96,7 +96,7 @@ jQuery.extend({
                                        // oldIE doesn't update selected after form reset (#2551)
                                        if ( ( option.selected || i === index ) &&
                                                        // 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" ) ) ) {
 
                                                // Get the specific value for the option
@@ -147,7 +147,7 @@ jQuery.each([ "radio", "checkbox" ], function() {
                        }
                }
        };
-       if ( !jQuery.support.checkOn ) {
+       if ( !support.checkOn ) {
                jQuery.valHooks[ this ].get = function( elem ) {
                        // Support: Webkit
                        // "" is returned instead of "on" if a value isn't specified
index cc13f1ed31fb8c3625578e91f73d4a8b7ce2d223..5fdec9175ca76b367768201a27650042c50050ba 100644 (file)
@@ -9,11 +9,14 @@ define([
        "./var/class2type",
        "./var/toString",
        "./var/hasOwn",
-       "./var/trim"
+       "./var/trim",
+       "./var/support"
 ], function( strundefined, deletedIds, slice, concat, push, indexOf,
-       class2type, toString, hasOwn, trim ) {
+       class2type, toString, hasOwn, trim, support ) {
 
 var
+       i,
+
        // A central reference to the root jQuery(document)
        rootjQuery,
 
@@ -364,43 +367,6 @@ jQuery.extend({
                        typeof obj;
        },
 
-       isPlainObject: function( obj ) {
-               var key;
-
-               // Must be an Object.
-               // Because of IE, we also have to check the presence of the constructor property.
-               // Make sure that DOM nodes and window objects don't pass through, as well
-               if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
-                       return false;
-               }
-
-               try {
-                       // Not own constructor property must be Object
-                       if ( obj.constructor &&
-                               !hasOwn.call(obj, "constructor") &&
-                               !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
-                               return false;
-                       }
-               } catch ( e ) {
-                       // IE8,9 Will throw exceptions on certain host objects #9897
-                       return false;
-               }
-
-               // Support: IE<9
-               // Handle iteration over inherited properties before own properties.
-               if ( jQuery.support.ownLast ) {
-                       for ( key in obj ) {
-                               return hasOwn.call( obj, key );
-                       }
-               }
-
-               // Own properties are enumerated firstly, so to speed up,
-               // if last one is own, then all properties are own.
-               for ( key in obj ) {}
-
-               return key === undefined || hasOwn.call( obj, key );
-       },
-
        isEmptyObject: function( obj ) {
                var name;
                for ( name in obj ) {
@@ -789,6 +755,60 @@ jQuery.extend({
 
        now: function() {
                return ( new Date() ).getTime();
+       },
+
+       // jQuery.support is not used in Core but other projects attach their
+       // properties to it so it needs to exist.
+       support: support
+});
+
+
+// Support: IE<9
+// Iteration over object's inherited properties before its own.
+// It would be better to move this test to one of test modules but since
+// tests require the jQuery object to exist as well as some other variables set
+// core initialization is needed first for tests used in core itself.
+for ( i in jQuery( support ) ) {
+       break;
+}
+support.ownLast = i !== "0";
+
+jQuery.extend({
+       isPlainObject: function( obj ) {
+               var key;
+
+               // Must be an Object.
+               // Because of IE, we also have to check the presence of the constructor property.
+               // Make sure that DOM nodes and window objects don't pass through, as well
+               if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+                       return false;
+               }
+
+               try {
+                       // Not own constructor property must be Object
+                       if ( obj.constructor &&
+                               !hasOwn.call(obj, "constructor") &&
+                               !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+                               return false;
+                       }
+               } catch ( e ) {
+                       // IE8,9 Will throw exceptions on certain host objects #9897
+                       return false;
+               }
+
+               // Support: IE<9
+               // Handle iteration over inherited properties before own properties.
+               if ( support.ownLast ) {
+                       for ( key in obj ) {
+                               return hasOwn.call( obj, key );
+                       }
+               }
+
+               // Own properties are enumerated firstly, so to speed up,
+               // if last one is own, then all properties are own.
+               for ( key in obj ) {}
+
+               return key === undefined || hasOwn.call( obj, key );
        }
 });
 
diff --git a/src/core/swap.js b/src/core/swap.js
deleted file mode 100644 (file)
index 95f4e2c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-define([
-       "../core"
-], function( jQuery ) {
-
-       // 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 ) {
-               var ret, name,
-                       old = {};
-
-               // Remember the old values, and insert the new ones
-               for ( name in options ) {
-                       old[ name ] = elem.style[ name ];
-                       elem.style[ name ] = options[ name ];
-               }
-
-               ret = callback.apply( elem, args || [] );
-
-               // Revert the old values
-               for ( name in options ) {
-                       elem.style[ name ] = old[ name ];
-               }
-
-               return ret;
-       };
-
-       return jQuery.swap;
-});
index 68ffb8e8327da4f17fcecd009dae90852f16c21d..660ed7df6dfb3ec5884a9c120898af2675d7acd3 100644 (file)
@@ -4,12 +4,12 @@ define([
        "./css/var/cssExpand",
        "./css/var/isHidden",
        "./css/defaultDisplay",
-       "./core/swap",
+       "./css/support",
+       "./css/swap",
        "./selector", // contains
-       "./support",
        // Optional
        "./offset"
-], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay ) {
+], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, support ) {
 
 var getStyles, curCSS,
        ralpha = /alpha\([^)]*\)/i,
@@ -185,7 +185,7 @@ jQuery.extend({
        // setting or getting the value
        cssProps: {
                // normalize float css property
-               "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+               "float": support.cssFloat ? "cssFloat" : "styleFloat"
        },
 
        // Get and set the style property on a DOM Node
@@ -229,7 +229,7 @@ jQuery.extend({
 
                        // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
                        // 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";
                        }
 
@@ -436,7 +436,7 @@ function getWidthOrHeight( elem, name, extra ) {
        var valueIsBorderBox = true,
                val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
                styles = getStyles( elem ),
-               isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+               isBorderBox = support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
 
        // some non-html elements return undefined for offsetWidth, so check for null/undefined
        // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
@@ -455,7 +455,7 @@ function getWidthOrHeight( elem, name, extra ) {
 
                // we need the check for style in case a browser which returns unreliable values
                // 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
                val = parseFloat( val ) || 0;
@@ -494,7 +494,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
                                        elem,
                                        name,
                                        extra,
-                                       jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+                                       support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
                                        styles
                                ) : 0
                        );
@@ -502,7 +502,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
        };
 });
 
-if ( !jQuery.support.opacity ) {
+if ( !support.opacity ) {
        jQuery.cssHooks.opacity = {
                get: function( elem, computed ) {
                        // IE uses filters for opacity
@@ -546,29 +546,58 @@ if ( !jQuery.support.opacity ) {
        };
 }
 
-// These hooks cannot be added until DOM ready because the support test
-// for it is not run until after DOM ready
-jQuery(function() {
-       if ( !jQuery.support.reliableMarginRight ) {
-               jQuery.cssHooks.marginRight = {
-                       get: function( elem, computed ) {
-                               if ( computed ) {
-                                       // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
-                                       // Work around by temporarily setting element display to inline-block
-                                       return jQuery.swap( elem, { "display": "inline-block" },
-                                               curCSS, [ elem, "marginRight" ] );
-                               }
+jQuery.cssHooks.marginRight = {
+       get: function( elem, computed ) {
+               var reliableMarginRight = support.reliableMarginRight();
+               if ( reliableMarginRight == null ) {
+                       // The test was not ready at this point; screw the hook this time
+                       // but check again when needed next time.
+                       return;
+               }
+
+               if ( reliableMarginRight ) {
+                       // Hook not needed, remove it.
+                       // Since there are no other hooks for marginRight, remove the whole object.
+                       delete jQuery.cssHooks.marginRight;
+                       return;
+               }
+
+               jQuery.cssHooks.marginRight.get = function ( elem, computed ) {
+                       if ( computed ) {
+                               // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+                               // Work around by temporarily setting element display to inline-block
+                               return jQuery.swap( elem, { "display": "inline-block" },
+                                       curCSS, [ elem, "marginRight" ] );
                        }
                };
+
+               return jQuery.cssHooks.marginRight.get( elem, computed );
        }
+};
+
+// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+// 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
+jQuery.each( [ "top", "left" ], function( i, prop ) {
+       jQuery.cssHooks[ prop ] = {
+               get: function( elem, computed ) {
+                       var pixelPosition = support.pixelPosition();
+
+                       if ( pixelPosition == null ) {
+                               // The test was not ready at this point; screw the hook this time
+                               // but check again when needed next time.
+                               return;
+                       }
+
+                       if ( pixelPosition ) {
+                               // Hook not needed, remove it.
+                               // Since there are no other hooks for prop, remove the whole object.
+                               delete jQuery.cssHooks[ prop ];
+                               return;
+                       }
 
-       // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
-       // 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
-       if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
-               jQuery.each( [ "top", "left" ], function( i, prop ) {
-                       jQuery.cssHooks[ prop ] = {
-                               get: function( elem, computed ) {
+                       jQuery.cssHooks[ prop ].get = function ( elem, computed ) {
+                               if ( !support.pixelPosition() && jQuery.fn.position ) {
                                        if ( computed ) {
                                                computed = curCSS( elem, prop );
                                                // if curCSS returns percentage, fallback to offset
@@ -578,8 +607,10 @@ jQuery(function() {
                                        }
                                }
                        };
-               });
-       }
+
+                       return jQuery.cssHooks[ prop ].get( elem, computed );
+               }
+       };
 });
 
 
diff --git a/src/css/hidden-visible-selectors.js b/src/css/hidden-visible-selectors.js
deleted file mode 100644 (file)
index 9145304..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-define([
-       "../core",
-       "../selector",
-       "../css"
-], function( jQuery ) {
-
-jQuery.expr.filters.hidden = function( elem ) {
-       // Support: Opera <= 12.12
-       // Opera reports offsetWidths and offsetHeights less than zero on some elements
-       return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
-               (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
-};
-
-jQuery.expr.filters.visible = function( elem ) {
-       return !jQuery.expr.filters.hidden( elem );
-};
-
-});
diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js
new file mode 100644 (file)
index 0000000..0bd86c8
--- /dev/null
@@ -0,0 +1,20 @@
+define([
+       "../core",
+       "./support",
+       "../selector",
+       "../css"
+], function( jQuery, support ) {
+
+jQuery.expr.filters.hidden = function( elem ) {
+       // Support: Opera <= 12.12
+       // Opera reports offsetWidths and offsetHeights less than zero on some elements
+       return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
+               (!support.reliableHiddenOffsets() &&
+                       ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+};
+
+jQuery.expr.filters.visible = function( elem ) {
+       return !jQuery.expr.filters.hidden( elem );
+};
+
+});
diff --git a/src/css/support.js b/src/css/support.js
new file mode 100644 (file)
index 0000000..afbe278
--- /dev/null
@@ -0,0 +1,192 @@
+define([
+       "../core",
+       "../var/support"
+], function( jQuery, support ) {
+
+(function () {
+       var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal,
+               pixelPositionVal, reliableMarginRightVal,
+               div = document.createElement( "div" ),
+               containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px",
+               divReset =
+                       "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
+                       "display:block;padding:0;margin:0;border:0";
+
+       // Setup
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+       a = div.getElementsByTagName( "a" )[ 0 ];
+
+       a.style.cssText = "float:left;opacity:.5";
+
+       // Make sure that element opacity exists
+       // (IE uses filter instead)
+       // Use a regex to work around a WebKit issue. See #5145
+       support.opacity = /^0.5/.test( a.style.opacity );
+
+       // Verify style float existence
+       // (IE uses styleFloat instead of cssFloat)
+       support.cssFloat = !!a.style.cssFloat;
+
+       div.style.backgroundClip = "content-box";
+       div.cloneNode( true ).style.backgroundClip = "";
+       support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+       // Null elements to avoid leaks in IE.
+       a = div = null;
+
+
+       jQuery.extend(support, {
+               reliableHiddenOffsets: function() {
+                       if ( reliableHiddenOffsetsVal != null ) {
+                               return reliableHiddenOffsetsVal;
+                       }
+
+                       var container, tds, isSupported,
+                               div = document.createElement( "div" ),
+                               body = document.getElementsByTagName( "body" )[ 0 ];
+
+                       if ( !body ) {
+                               // Return for frameset docs that don't have a body
+                               return;
+                       }
+
+                       // Setup
+                       div.setAttribute( "className", "t" );
+                       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+                       container = document.createElement( "div" );
+                       container.style.cssText = containerStyles;
+
+                       body.appendChild( container ).appendChild( div );
+
+                       // Support: IE8
+                       // Check if table cells still have offsetWidth/Height when they are set
+                       // to display:none and there are still other visible table cells in a
+                       // table row; if so, offsetWidth/Height are not reliable for use when
+                       // determining if an element has been hidden directly using
+                       // display:none (it is still safe to use offsets if a parent element is
+                       // hidden; don safety goggles and see bug #4512 for more information).
+                       div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+                       tds = div.getElementsByTagName( "td" );
+                       tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+                       isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+                       tds[ 0 ].style.display = "";
+                       tds[ 1 ].style.display = "none";
+
+                       // Support: IE8
+                       // Check if empty table cells still have offsetWidth/Height
+                       reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+                       // Null elements to avoid leaks in IE.
+                       div = body = null;
+
+                       return reliableHiddenOffsetsVal;
+               },
+
+               boxSizing: function() {
+                       if ( boxSizingVal == null ) {
+                               computeStyleTests();
+                       }
+                       return boxSizingVal;
+               },
+
+               boxSizingReliable: function() {
+                       if ( boxSizingReliableVal == null ) {
+                               computeStyleTests();
+                       }
+                       return boxSizingReliableVal;
+               },
+
+               pixelPosition: function() {
+                       if ( pixelPositionVal == null ) {
+                               computeStyleTests();
+                       }
+                       return pixelPositionVal;
+               },
+
+               reliableMarginRight: function() {
+                       var body, container, div, marginDiv;
+
+                       // Use window.getComputedStyle because jsdom on node.js will break without it.
+                       if ( reliableMarginRightVal == null && window.getComputedStyle ) {
+                               body = document.getElementsByTagName( "body" )[ 0 ];
+                               if ( !body ) {
+                                       // Test fired too early or in an unsupported environment, exit.
+                                       return;
+                               }
+
+                               container = document.createElement( "div" );
+                               div = document.createElement( "div" );
+                               container.style.cssText = containerStyles;
+
+                               body.appendChild( container ).appendChild( div );
+
+                               // Check if div with explicit width and no margin-right incorrectly
+                               // gets computed margin-right based on width of container. (#3333)
+                               // Fails in WebKit before Feb 2011 nightlies
+                               // 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";
+
+                               reliableMarginRightVal =
+                                       !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+
+                               body.removeChild( container );
+                       }
+
+                       return reliableMarginRightVal;
+               }
+       });
+
+       function computeStyleTests() {
+               var container, div,
+                       body = document.getElementsByTagName( "body" )[ 0 ];
+
+               if ( !body ) {
+                       // Test fired too early or in an unsupported environment, exit.
+                       return;
+               }
+
+               container = document.createElement( "div" );
+               div = document.createElement( "div" );
+               container.style.cssText = containerStyles;
+
+               body.appendChild( container ).appendChild( div );
+
+               div.style.cssText =
+                       "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
+                               "position:absolute;display:block;padding:1px;border:1px;width:4px;" +
+                               "margin-top:1%;top:1%";
+
+               // Workaround failing boxSizing test due to offsetWidth returning wrong value
+               // with some non-1 values of body zoom, ticket #13543
+               jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
+                       boxSizingVal = div.offsetWidth === 4;
+               });
+
+               // Will be changed later if needed.
+               boxSizingReliableVal = true;
+               pixelPositionVal = false;
+               reliableMarginRightVal = true;
+
+               // Use window.getComputedStyle because jsdom on node.js will break without it.
+               if ( window.getComputedStyle ) {
+                       pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+                       boxSizingReliableVal =
+                               ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+               }
+
+               body.removeChild( container );
+
+               // Null elements to avoid leaks in IE.
+               div = body = null;
+       }
+
+})();
+
+return support;
+
+});
diff --git a/src/css/swap.js b/src/css/swap.js
new file mode 100644 (file)
index 0000000..07a661c
--- /dev/null
@@ -0,0 +1,27 @@
+define([
+       "../core"
+], function( jQuery ) {
+
+       // A method for quickly swapping in/out CSS properties to get correct calculations.
+       jQuery.swap = function( elem, options, callback, args ) {
+               var ret, name,
+                       old = {};
+
+               // Remember the old values, and insert the new ones
+               for ( name in options ) {
+                       old[ name ] = elem.style[ name ];
+                       elem.style[ name ] = options[ name ];
+               }
+
+               ret = callback.apply( elem, args || [] );
+
+               // Revert the old values
+               for ( name in options ) {
+                       elem.style[ name ] = old[ name ];
+               }
+
+               return ret;
+       };
+
+       return jQuery.swap;
+});
index 545f041b30623b154ac010c8a5fbf256c4353571..de7268ef841787d4453b324f5c9f1fed42043edc 100644 (file)
@@ -1,8 +1,9 @@
 define([
        "./core",
        "./var/deletedIds",
+       "./data/support",
        "./data/accepts"
-], function( jQuery, deletedIds ) {
+], function( jQuery, deletedIds, support ) {
 
 var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
        rmultiDash = /([A-Z])/g;
@@ -225,7 +226,7 @@ function internalRemoveData( elem, name, pvt ) {
 
        // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
        /* jshint eqeqeq: false */
-       } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+       } else if ( support.deleteExpando || cache != cache.window ) {
                /* jshint eqeqeq: true */
                delete cache[ id ];
 
diff --git a/src/data/support.js b/src/data/support.js
new file mode 100644 (file)
index 0000000..52250b2
--- /dev/null
@@ -0,0 +1,25 @@
+define([
+       "../var/support"
+], function( support ) {
+
+(function () {
+       var div = document.createElement( "div" );
+
+       // Execute the test only if not already executed in another module.
+       if (support.deleteExpando == null) {
+               // Support: IE<9
+               support.deleteExpando = true;
+               try {
+                       delete div.test;
+               } catch( e ) {
+                       support.deleteExpando = false;
+               }
+       }
+
+       // Null elements to avoid leaks in IE.
+       div = null;
+})();
+
+return support;
+
+});
index e708cb32b4413098763cf8df88ff04639f2718ee..e64bf045a993387c3c680f344a1a39be3d24f958 100644 (file)
@@ -3,12 +3,14 @@ define([
        "./var/pnum",
        "./css/var/cssExpand",
        "./css/var/isHidden",
+       "./css/defaultDisplay",
+       "./effects/support",
        "./effects/Tween",
        "./queue",
        "./css",
        "./deferred",
        "./traversing"
-], function( jQuery, pnum, cssExpand, isHidden, Tween ) {
+], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, support) {
 
 var fxNow, timerId,
        rfxtypes = /^(?:toggle|show|hide)$/,
@@ -309,9 +311,8 @@ function defaultPrefilter( elem, props, opts ) {
 
                        // inline-level elements accept inline-block;
                        // block-level elements need to be inline with layout
-                       if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
+                       if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
                                style.display = "inline-block";
-
                        } else {
                                style.zoom = 1;
                        }
@@ -320,7 +321,7 @@ function defaultPrefilter( elem, props, opts ) {
 
        if ( opts.overflow ) {
                style.overflow = "hidden";
-               if ( !jQuery.support.shrinkWrapBlocks ) {
+               if ( !support.shrinkWrapBlocks() ) {
                        anim.always(function() {
                                style.overflow = opts.overflow[ 0 ];
                                style.overflowX = opts.overflow[ 1 ];
diff --git a/src/effects/animated-selector.js b/src/effects/animated-selector.js
deleted file mode 100644 (file)
index 290e32b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-define([
-       "../core",
-       "../selector",
-       "../effects",
-], function( jQuery ) {
-       jQuery.expr.filters.animated = function( elem ) {
-               return jQuery.grep(jQuery.timers, function( fn ) {
-                       return elem === fn.elem;
-               }).length;
-       };
-});
\ No newline at end of file
diff --git a/src/effects/animatedSelector.js b/src/effects/animatedSelector.js
new file mode 100644 (file)
index 0000000..290e32b
--- /dev/null
@@ -0,0 +1,11 @@
+define([
+       "../core",
+       "../selector",
+       "../effects",
+], function( jQuery ) {
+       jQuery.expr.filters.animated = function( elem ) {
+               return jQuery.grep(jQuery.timers, function( fn ) {
+                       return elem === fn.elem;
+               }).length;
+       };
+});
\ No newline at end of file
diff --git a/src/effects/support.js b/src/effects/support.js
new file mode 100644 (file)
index 0000000..0299cae
--- /dev/null
@@ -0,0 +1,76 @@
+define([
+       "../var/strundefined",
+       "../var/support"
+], function( strundefined, support ) {
+
+(function () {
+       var a, shrinkWrapBlocksVal,
+               div = document.createElement( "div" ),
+               divReset =
+                       "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
+                       "display:block;padding:0;margin:0;border:0";
+
+       // Setup
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+       a = div.getElementsByTagName( "a" )[ 0 ];
+
+       a.style.cssText = "float:left;opacity:.5";
+
+       // Make sure that element opacity exists
+       // (IE uses filter instead)
+       // Use a regex to work around a WebKit issue. See #5145
+       support.opacity = /^0.5/.test( a.style.opacity );
+
+       // Verify style float existence
+       // (IE uses styleFloat instead of cssFloat)
+       support.cssFloat = !!a.style.cssFloat;
+
+       div.style.backgroundClip = "content-box";
+       div.cloneNode( true ).style.backgroundClip = "";
+       support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+       // Null elements to avoid leaks in IE.
+       a = div = null;
+
+       support.shrinkWrapBlocks = function () {
+               var body, container, div, containerStyles;
+
+               if ( shrinkWrapBlocksVal == null ) {
+                       body = document.getElementsByTagName( "body" )[ 0 ];
+                       if ( !body ) {
+                               // Test fired too early or in an unsupported environment, exit.
+                               return;
+                       }
+
+                       containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px";
+                       container = document.createElement( "div" );
+                       div = document.createElement( "div" );
+
+                       body.appendChild( container ).appendChild( div );
+
+                       // Will be changed later if needed.
+                       shrinkWrapBlocksVal = false;
+
+                       if ( typeof div.style.zoom !== strundefined ) {
+                               // Support: IE6
+                               // Check if elements with layout shrink-wrap their children
+                               div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1";
+                               div.innerHTML = "<div></div>";
+                               div.firstChild.style.width = "5px";
+                               shrinkWrapBlocksVal = div.offsetWidth !== 3;
+                       }
+
+                       body.removeChild( container );
+
+                       // Null elements to avoid leaks in IE.
+                       body = container = div = null;
+               }
+
+               return shrinkWrapBlocksVal;
+       };
+
+})();
+
+return support;
+
+});
index d0e16bb1e2b8a9f25cbe11302753090fe33bbbcb..3ec6e400c5d2781c921ebc23e5c0d97deb0acf5d 100644 (file)
@@ -4,10 +4,10 @@ define([
        "./var/rnotwhite",
        "./var/hasOwn",
        "./var/slice",
+       "./event/support",
        "./data/accepts",
-       "./selector",
-       "./support"
-], function( jQuery, strundefined, rnotwhite, hasOwn, slice ) {
+       "./selector"
+], function( jQuery, strundefined, rnotwhite, hasOwn, slice, support ) {
 
 var rformElems = /^(?:input|select|textarea)$/i,
        rkeyEvent = /^key/,
@@ -772,7 +772,7 @@ jQuery.each({
 });
 
 // IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
+if ( !support.submitBubbles ) {
 
        jQuery.event.special.submit = {
                setup: function() {
@@ -819,7 +819,7 @@ if ( !jQuery.support.submitBubbles ) {
 }
 
 // IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
+if ( !support.changeBubbles ) {
 
        jQuery.event.special.change = {
 
@@ -878,7 +878,7 @@ if ( !jQuery.support.changeBubbles ) {
 }
 
 // Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
+if ( !support.focusinBubbles ) {
        jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
 
                // Attach a single capturing handler while someone wants focusin/focusout
diff --git a/src/event/support.js b/src/event/support.js
new file mode 100644 (file)
index 0000000..1912b84
--- /dev/null
@@ -0,0 +1,23 @@
+define([
+       "../var/support"
+], function( support ) {
+
+(function () {
+       var i, eventName,
+               div = document.createElement("div" );
+
+       // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+       // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
+       for ( i in { submit: true, change: true, focusin: true }) {
+               div.setAttribute( eventName = "on" + i, "t" );
+
+               support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+       }
+
+       // Null elements to avoid leaks in IE.
+       div = null;
+})();
+
+return support;
+
+});
index 2c63e36060e3f99d7b3047b447043cf0bc36f8dd..5c3d27ff8fd4c520c67ffffb1c611d704ed4fa4c 100644 (file)
@@ -16,7 +16,7 @@ define([
        "./manipulation/_evalUrl",
        "./wrap",
        "./css",
-       "./css/hidden-visible-selectors",
+       "./css/hiddenVisibleSelectors",
        "./serialize",
        "./ajax",
        "./ajax/xhr",
@@ -24,7 +24,7 @@ define([
        "./ajax/jsonp",
        "./ajax/load",
        "./effects",
-       "./effects/animated-selector",
+       "./effects/animatedSelector",
        "./offset",
        "./dimensions",
        "./deprecated",
index faa11eb284ef97601d9e3f7140510cf33ff07746..b98b08ce938b6f7979ea1a1dde17dacfa6e030a3 100644 (file)
@@ -5,12 +5,12 @@ define([
        "./var/deletedIds",
        "./var/strundefined",
        "./manipulation/var/rcheckableType",
+       "./manipulation/support",
        "./data/accepts",
        "./selector",
        "./traversing",
-       "./event",
-       "./support"
-], function( jQuery, concat, push, deletedIds, strundefined, rcheckableType ){
+       "./event"
+], function( jQuery, concat, push, deletedIds, strundefined, rcheckableType, support ){
 
 function createSafeFragment( document ) {
        var list = nodeNames.split( "|" ),
@@ -55,7 +55,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
 
                // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
                // unless wrapped in a div with non-breaking characters in front of it.
-               _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
+               _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"  ]
        },
        safeFragment = createSafeFragment( document ),
        fragmentDiv = safeFragment.appendChild( document.createElement("div") );
@@ -177,8 +177,8 @@ jQuery.fn.extend({
 
                        // See if we can take a shortcut and just use innerHTML
                        if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
-                               ( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
-                               ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+                               ( support.htmlSerialize || !rnoshimcache.test( value )  ) &&
+                               ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
                                !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
 
                                value = value.replace( rxhtmlTag, "<$1></$2>" );
@@ -252,7 +252,7 @@ jQuery.fn.extend({
                        isFunction = jQuery.isFunction( value );
 
                // 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 ) {
                                var self = set.eq( index );
                                if ( isFunction ) {
@@ -398,7 +398,7 @@ function fixCloneNodeIssues( src, dest ) {
        nodeName = dest.nodeName.toLowerCase();
 
        // IE6-8 copies events bound via attachEvent when using cloneNode.
-       if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+       if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
                data = jQuery._data( dest );
 
                for ( e in data.events ) {
@@ -425,7 +425,7 @@ function fixCloneNodeIssues( src, dest ) {
                // element in IE9, the outerHTML strategy above is not sufficient.
                // If the src has innerHTML and the destination does not,
                // copy the src.innerHTML into the dest.innerHTML. #10324
-               if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+               if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
                        dest.innerHTML = src.innerHTML;
                }
 
@@ -514,7 +514,7 @@ jQuery.extend({
                var destElements, node, clone, i, srcElements,
                        inPage = jQuery.contains( elem.ownerDocument, elem );
 
-               if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+               if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
                        clone = elem.cloneNode( true );
 
                // IE<=8 does not properly clone detached, unknown element nodes
@@ -523,7 +523,7 @@ jQuery.extend({
                        fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
                }
 
-               if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+               if ( (!support.noCloneEvent || !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
@@ -606,12 +606,12 @@ jQuery.extend({
                                        }
 
                                        // Manually add leading whitespace removed by IE
-                                       if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+                                       if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
                                                nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
                                        }
 
                                        // Remove IE's autoinserted <tbody> from table fragments
-                                       if ( !jQuery.support.tbody ) {
+                                       if ( !support.tbody ) {
 
                                                // String was a <table>, *may* have spurious <tbody>
                                                elem = tag === "table" && !rtbody.test( elem ) ?
@@ -653,7 +653,7 @@ jQuery.extend({
 
                // Reset defaultChecked for any radios and checkboxes
                // about to be appended to the DOM in IE 6/7 (#8060)
-               if ( !jQuery.support.appendChecked ) {
+               if ( !support.appendChecked ) {
                        jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
                }
 
@@ -697,7 +697,7 @@ jQuery.extend({
                        i = 0,
                        internalKey = jQuery.expando,
                        cache = jQuery.cache,
-                       deleteExpando = jQuery.support.deleteExpando,
+                       deleteExpando = support.deleteExpando,
                        special = jQuery.event.special;
 
                for ( ; (elem = elems[i]) != null; i++ ) {
diff --git a/src/manipulation/support.js b/src/manipulation/support.js
new file mode 100644 (file)
index 0000000..fda9db6
--- /dev/null
@@ -0,0 +1,78 @@
+define([
+       "../var/support"
+], function( support ) {
+
+(function () {
+       var input, fragment,
+               div = document.createElement("div");
+
+       // Setup
+       div.setAttribute( "className", "t" );
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+       input = div.getElementsByTagName("input")[ 0 ];
+       input.type = "checkbox";
+
+       // IE strips leading whitespace when .innerHTML is used
+       support.leadingWhitespace = div.firstChild.nodeType === 3;
+
+       // Make sure that tbody elements aren't automatically inserted
+       // IE will insert them into empty tables
+       support.tbody = !div.getElementsByTagName( "tbody" ).length;
+
+       // Make sure that link elements get serialized correctly by innerHTML
+       // This requires a wrapper element in IE
+       support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
+
+       // Makes sure cloning an html5 element does not cause problems
+       // Where outerHTML is undefined, this still works
+       support.html5Clone =
+               document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
+
+       // Make sure checked status is properly cloned
+       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 = document.createDocumentFragment();
+       fragment.appendChild( input );
+
+       // Check if a disconnected checkbox will retain its checked
+       // value of true after appended to the DOM (IE6/7)
+       support.appendChecked = input.checked;
+
+       // WebKit doesn't clone checked state correctly in fragments
+       support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+       // Support: IE<9
+       // Opera does not clone events (and typeof div.attachEvent === undefined).
+       // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+       support.noCloneEvent = true;
+       if ( div.attachEvent ) {
+               div.attachEvent( "onclick", function() {
+                       support.noCloneEvent = false;
+               });
+
+               div.cloneNode( true ).click();
+       }
+
+       // Execute the test only if not already executed in another module.
+       if (support.deleteExpando == null) {
+               // Support: IE<9
+               support.deleteExpando = true;
+               try {
+                       delete div.test;
+               } catch( e ) {
+                       support.deleteExpando = false;
+               }
+       }
+
+       // Null elements to avoid leaks in IE.
+       input = fragment = div = null;
+})();
+
+return support;
+
+});
index 705a5b0fd9fb720d653c518f070bcbb401b24d64..832f192d51c48d01c322b575dfa3014f1382f6ed 100644 (file)
 define([
        "./core",
        "./var/strundefined",
-       "./core/swap",
+       "./var/support",
        // This is listed as a dependency for build order, but it's still optional in builds
        "./core/ready"
-], function( jQuery, strundefined ) {
+], function( jQuery, strundefined, support ) {
 
-jQuery.support = (function( support ) {
+// Note: most support tests are defined in their respective modules.
 
-       var all, a, input, select, fragment, opt, eventName, isSupported, i,
-               div = document.createElement("div");
+jQuery(function() {
+       // We need to execute this one support test ASAP because we need to know
+       // if body.style.zoom needs to be set.
 
-       // Setup
-       div.setAttribute( "className", "t" );
-       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+       var container,
+               div = document.createElement( "div" ),
+               divReset =
+                       "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
+                       "display:block;padding:0;margin:0;border:0",
+               body = document.getElementsByTagName("body")[0];
 
-       // Finish early in limited (non-browser) environments
-       all = div.getElementsByTagName("*") || [];
-       a = div.getElementsByTagName("a")[ 0 ];
-       if ( !a || !a.style || !all.length ) {
-               return support;
+       if ( !body ) {
+               // Return for frameset docs that don't have a body
+               return;
        }
 
-       // First batch of tests
-       select = document.createElement("select");
-       opt = select.appendChild( document.createElement("option") );
-       input = div.getElementsByTagName("input")[ 0 ];
-
-       a.style.cssText = "top:1px;float:left;opacity:.5";
-
-       // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
-       support.getSetAttribute = div.className !== "t";
-
-       // IE strips leading whitespace when .innerHTML is used
-       support.leadingWhitespace = div.firstChild.nodeType === 3;
-
-       // Make sure that tbody elements aren't automatically inserted
-       // IE will insert them into empty tables
-       support.tbody = !div.getElementsByTagName("tbody").length;
-
-       // Make sure that link elements get serialized correctly by innerHTML
-       // This requires a wrapper element in IE
-       support.htmlSerialize = !!div.getElementsByTagName("link").length;
-
-       // Get the style information from getAttribute
-       // (IE uses .cssText instead)
-       support.style = /top/.test( a.getAttribute("style") );
-
-       // Make sure that URLs aren't manipulated
-       // (IE normalizes it by default)
-       support.hrefNormalized = a.getAttribute("href") === "/a";
-
-       // Make sure that element opacity exists
-       // (IE uses filter instead)
-       // Use a regex to work around a WebKit issue. See #5145
-       support.opacity = /^0.5/.test( a.style.opacity );
-
-       // Verify style float existence
-       // (IE uses styleFloat instead of cssFloat)
-       support.cssFloat = !!a.style.cssFloat;
-
-       // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
-       support.checkOn = !!input.value;
-
-       // Make sure that a selected-by-default option has a working selected property.
-       // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
-       support.optSelected = opt.selected;
+       // Setup
+       div.setAttribute( "className", "t" );
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
 
-       // Tests for enctype support on a form (#6743)
-       support.enctype = !!document.createElement("form").enctype;
+       container = document.createElement( "div" );
+       container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
 
-       // Makes sure cloning an html5 element does not cause problems
-       // Where outerHTML is undefined, this still works
-       support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
+       body.appendChild( container ).appendChild( div );
 
-       // Will be defined later
+       // Will be changed later if needed.
        support.inlineBlockNeedsLayout = false;
-       support.shrinkWrapBlocks = false;
-       support.pixelPosition = false;
-       support.deleteExpando = true;
-       support.noCloneEvent = true;
-       support.reliableMarginRight = true;
-       support.boxSizingReliable = true;
-
-       // Make sure checked status is properly cloned
-       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;
-
-       // Support: IE<9
-       try {
-               delete div.test;
-       } catch( e ) {
-               support.deleteExpando = false;
-       }
-
-       // Check if we can trust getAttribute("value")
-       input = document.createElement("input");
-       input.setAttribute( "value", "" );
-       support.input = input.getAttribute( "value" ) === "";
-
-       // Check if an input maintains its value after becoming a radio
-       input.value = "t";
-       input.setAttribute( "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 = document.createDocumentFragment();
-       fragment.appendChild( input );
-
-       // Check if a disconnected checkbox will retain its checked
-       // value of true after appended to the DOM (IE6/7)
-       support.appendChecked = input.checked;
-
-       // WebKit doesn't clone checked state correctly in fragments
-       support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
-       // Support: IE<9
-       // Opera does not clone events (and typeof div.attachEvent === undefined).
-       // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
-       if ( div.attachEvent ) {
-               div.attachEvent( "onclick", function() {
-                       support.noCloneEvent = false;
-               });
 
-               div.cloneNode( true ).click();
-       }
-
-       // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
-       // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
-       for ( i in { submit: true, change: true, focusin: true }) {
-               div.setAttribute( eventName = "on" + i, "t" );
-
-               support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
-       }
-
-       div.style.backgroundClip = "content-box";
-       div.cloneNode( true ).style.backgroundClip = "";
-       support.clearCloneStyle = div.style.backgroundClip === "content-box";
-
-       // Support: IE<9
-       // Iteration over object's inherited properties before its own.
-       for ( i in jQuery( support ) ) {
-               break;
-       }
-       support.ownLast = i !== "0";
-
-       // Run tests that need a body at doc ready
-       jQuery(function() {
-               var container, marginDiv, tds,
-                       divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
-                       body = document.getElementsByTagName("body")[0];
-
-               if ( !body ) {
-                       // Return for frameset docs that don't have a body
-                       return;
-               }
-
-               container = document.createElement("div");
-               container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
-
-               body.appendChild( container ).appendChild( div );
-
-               // Support: IE8
-               // Check if table cells still have offsetWidth/Height when they are set
-               // to display:none and there are still other visible table cells in a
-               // table row; if so, offsetWidth/Height are not reliable for use when
-               // determining if an element has been hidden directly using
-               // display:none (it is still safe to use offsets if a parent element is
-               // hidden; don safety goggles and see bug #4512 for more information).
-               div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
-               tds = div.getElementsByTagName("td");
-               tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
-               isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
-               tds[ 0 ].style.display = "";
-               tds[ 1 ].style.display = "none";
-
-               // Support: IE8
-               // Check if empty table cells still have offsetWidth/Height
-               support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
-               // Check box-sizing and margin behavior.
+       if ( typeof div.style.zoom !== strundefined ) {
+               // Support: IE<8
+               // Check if natively block-level elements act like inline-block
+               // elements when setting their display to 'inline' and giving
+               // them layout
                div.innerHTML = "";
-               div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
-
-               // Workaround failing boxSizing test due to offsetWidth returning wrong value
-               // with some non-1 values of body zoom, ticket #13543
-               jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
-                       support.boxSizing = div.offsetWidth === 4;
-               });
-
-               // Use window.getComputedStyle because jsdom on node.js will break without it.
-               if ( window.getComputedStyle ) {
-                       support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
-                       support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
-
-                       // Check if div with explicit width and no margin-right incorrectly
-                       // gets computed margin-right based on width of container. (#3333)
-                       // Fails in WebKit before Feb 2011 nightlies
-                       // 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 );
-               }
+               div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+               support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
 
-               if ( typeof div.style.zoom !== strundefined ) {
+               if ( support.inlineBlockNeedsLayout ) {
+                       // Prevent IE 6 from affecting layout for positioned elements #11048
+                       // Prevent IE from shrinking the body in IE 7 mode #12869
                        // Support: IE<8
-                       // Check if natively block-level elements act like inline-block
-                       // elements when setting their display to 'inline' and giving
-                       // them layout
-                       div.innerHTML = "";
-                       div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
-                       support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
-
-                       // Support: IE6
-                       // Check if elements with layout shrink-wrap their children
-                       div.style.display = "block";
-                       div.innerHTML = "<div></div>";
-                       div.firstChild.style.width = "5px";
-                       support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
-
-                       if ( support.inlineBlockNeedsLayout ) {
-                               // Prevent IE 6 from affecting layout for positioned elements #11048
-                               // Prevent IE from shrinking the body in IE 7 mode #12869
-                               // Support: IE<8
-                               body.style.zoom = 1;
-                       }
+                       body.style.zoom = 1;
                }
+       }
 
-               body.removeChild( container );
-
-               // Null elements to avoid leaks in IE
-               container = div = tds = marginDiv = null;
-       });
+       body.removeChild( container );
 
        // Null elements to avoid leaks in IE
-       all = select = fragment = opt = a = input = null;
-
-       return support;
-})({});
+       container = div = null;
+});
 
 });
index 84b8af09f92f5c37a8e20a28e8e692b0cafe94ce..5d4c5025b759b8921eebc12042ccef8f548161f6 100644 (file)
@@ -1,8 +1,7 @@
 define([
        "./core",
-       "./var/indexOf",
        "./selector"
-], function( jQuery, indexOf ) {
+], function( jQuery ) {
 var isSimple = /^.[^:#\[\.,]*$/,
        rparentsprev = /^(?:parents|prev(?:Until|All))/,
        rneedsContext = jQuery.expr.match.needsContext,
diff --git a/src/var/support.js b/src/var/support.js
new file mode 100644 (file)
index 0000000..b25dbc7
--- /dev/null
@@ -0,0 +1,4 @@
+define(function() {
+       // All support tests are defined in their respective modules.
+       return {};
+});
diff --git a/test/data/css/cssWidthBeforeDocReady.html b/test/data/css/cssWidthBeforeDocReady.html
new file mode 100644 (file)
index 0000000..3bdd1b5
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <meta charset="utf-8">
+       <style>
+               #test {
+                       -webkit-box-sizing: border-box;
+                       -moz-box-sizing: border-box;
+                       box-sizing: border-box;
+                       width: 100px;
+                       height: 100px;
+                       padding: 10px;
+               }
+       </style>
+</head>
+<body>
+<div id="test"></div>
+<script src="../../jquery.js"></script>
+<script>
+       var testWidth = jQuery( "#test" ).css( 'width' );
+       jQuery(function() {
+               window.parent.iframeCallback( testWidth );
+       });
+</script>
+</body>
+</html>
index 8991007cf7c8c02e990bbc3895ff51c0f7bd3598..83ddb2fc1a94673c67e43a07d62bc6d2848ccf1d 100644 (file)
 <body>
        <div>
                <script src="../../jquery.js"></script>
+               <script src="getComputedSupport.js"></script>
        </div>
        <script>
                jQuery(function() {
-                       window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support );
+                       window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ),
+                                       getComputedSupport( jQuery.support ) );
                });
        </script>
 </body>
index 63c4c90b7770d754a2593bd613f6b51e59513c5f..d73396f96c6a89b22e2484db1e8879da6d32ac9f 100644 (file)
@@ -12,7 +12,7 @@
 <script src="../../jquery.js"></script>
 <script>
        jQuery(function() {
-               window.parent.iframeCallback( jQuery.support.boxSizing );
+               window.parent.iframeCallback( jQuery.support.boxSizing() );
        });
 </script>
 </body>
index 8bce34fd2a60874676af9f1d7ee9436777768e95..a25bd8ae5204bb1af394dc7f3c0bac39230d3298 100644 (file)
@@ -1,3 +1,3 @@
 jQuery(function() {
-       parent.iframeCallback( jQuery.support );
+       parent.iframeCallback( getComputedSupport( jQuery.support ) );
 });
index f72aa07685693343fcc509fc1335739909099f59..b21ce0f745039c48e4f078b6d7d07bc726b1aca0 100644 (file)
@@ -15,6 +15,7 @@
        <title>CSP Test Page</title>
        <script src="../../jquery.js"></script>
        <script src="csp.js"></script>
+       <script src="getComputedSupport.js"></script>
 </head>
 <body>
        <p>CSP Test Page</p>
diff --git a/test/data/support/getComputedSupport.js b/test/data/support/getComputedSupport.js
new file mode 100644 (file)
index 0000000..ce3f118
--- /dev/null
@@ -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;
+}
index a2097cb21c5cbf395b7b395dc8b295ef216e3583..d781423ec820110942542c59dd2acde7d0c4dd85 100644 (file)
@@ -16,7 +16,7 @@
        </div>
        <script>
                jQuery(function() {
-                       window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks );
+                       window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks() );
                });
        </script>
 </body>
index 353aac045dbdc077c214f57bcf4be1afe3072d1c..23e52aca75e28e7afff246d8b3ecc31466d1e219 100644 (file)
@@ -836,6 +836,14 @@ 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");
 });
 
+testIframeWithCallback( "css('width') should work correctly before document ready (#14084)",
+       "css/cssWidthBeforeDocReady.html",
+       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() {
        expect ( 2 );
 
index ac0e8a66d128ef68e804dad6469c662612561518..be2867e74d4fb3b7881810f4fa66048b90318142 100644 (file)
@@ -1078,7 +1078,7 @@ jQuery.each({
 
 asyncTest("Effects chaining", function() {
        var remaining = 16,
-               shrinkwrap = jQuery.support.shrinkWrapBlocks,
+               shrinkwrap = jQuery.support.shrinkWrapBlocks(),
                props = [ "opacity", "height", "width", "display", "overflow" ],
                setup = function( name, selector, hiddenOverflow ) {
                        var $el = jQuery( selector );
index 41d3aa32025008bfb332ad86485be9514c6f7f65..eda6a51954b18067965ebd1a86d5ee96f5be9b40 100644 (file)
@@ -1,9 +1,26 @@
 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;
+}
+
 test( "zoom of doom (#13089)", function() {
        expect( 1 );
 
-       if ( jQuery.support.inlineBlockNeedsLayout ) {
+       if ( computedSupport.inlineBlockNeedsLayout ) {
                ok( document.body.style.zoom, "Added a zoom to the body (#11048, #12869)" );
        } else {
                ok( !document.body.style.zoom, "No zoom added to the body" );
@@ -21,7 +38,7 @@ if ( jQuery.css ) {
                stop();
                // Run doc ready tests as well
                jQuery(function() {
-                       deepEqual( jQuery.extend( {}, support ), jQuery.support, "Same support properties" );
+                       deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" );
                        start();
                });
        });
@@ -29,7 +46,7 @@ if ( jQuery.css ) {
 
 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" );
+       equal( boxSizing, computedSupport.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() {
@@ -39,201 +56,208 @@ testIframeWithCallback( "A background on the testElement does not cause IE8 to c
 
 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" );
+       strictEqual( shrinkWrapBlocks, computedSupport.shrinkWrapBlocks, "jQuery.support.shrinkWrapBlocks properties are the same" );
 });
 
 (function() {
-       var expected, version,
+       var expected,
                userAgent = window.navigator.userAgent;
 
        if ( /chrome/i.test( userAgent ) ) {
-               version = userAgent.match( /chrome\/(\d+)/i )[ 1 ];
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
-                       "cssFloat": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": true,
+                       "changeBubbles": true,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": true,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": true,
+                       "cors": true,
+                       "cssFloat": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": false,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": true,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": true,
+                       "ownLast": false,
+                       "pixelPosition": true,
                        "radioValue": true,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": true,
-                       "clearCloneStyle": true,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": true,
-                       "pixelPosition": version >= 28
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        } else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
-                       "cssFloat": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": true,
+                       "changeBubbles": true,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": true,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": true,
+                       "cors": true,
+                       "cssFloat": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": false,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": true,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": true,
+                       "ownLast": false,
+                       "pixelPosition": true,
                        "radioValue": false,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": true,
-                       "clearCloneStyle": true,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": true,
-                       "pixelPosition": true
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        } else if ( /msie 10\.0/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
-                       "cssFloat": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": false,
+                       "changeBubbles": true,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": false,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": false,
+                       "cors": true,
+                       "cssFloat": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": true,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": false,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": false,
+                       "ownLast": false,
+                       "pixelPosition": true,
                        "radioValue": false,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": true,
-                       "clearCloneStyle": false,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": false,
-                       "pixelPosition": true
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        } else if ( /msie 9\.0/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
-                       "cssFloat": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": false,
+                       "changeBubbles": true,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": false,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": false,
+                       "cors": false,
+                       "cssFloat": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": true,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": false,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": false,
+                       "ownLast": false,
+                       "pixelPosition": true,
                        "radioValue": false,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": false,
-                       "clearCloneStyle": false,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": false,
-                       "pixelPosition": true
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        } else if ( /msie 8\.0/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": false,
-                       "tbody": true,
-                       "htmlSerialize": false,
-                       "style": false,
-                       "hrefNormalized": true,
-                       "opacity": false,
-                       "cssFloat": false,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": true,
+                       "changeBubbles": false,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": false,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": true,
+                       "cors": false,
+                       "cssFloat": false,
+                       "deleteExpando": false,
                        "enctype": true,
-                       "html5Clone": false,
-                       "submitBubbles": false,
-                       "changeBubbles": false,
                        "focusinBubbles": true,
-                       "deleteExpando": false,
-                       "noCloneEvent": false,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": false,
+                       "htmlSerialize": false,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": false,
+                       "leadingWhitespace": false,
                        "noCloneChecked": false,
+                       "noCloneEvent": false,
+                       "opacity": false,
                        "optDisabled": true,
+                       "optSelected": false,
+                       "ownLast": true,
+                       "pixelPosition": false,
                        "radioValue": false,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": false,
-                       "ajax": true,
-                       "cors": false,
-                       "clearCloneStyle": true,
-                       "ownLast": true,
-                       "boxSizing": true,
-                       "boxSizingReliable": true,
-                       "pixelPosition": false
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": false,
+                       "submitBubbles": false,
+                       "tbody": true
                };
        } else if ( /msie 7\.0/i.test( userAgent ) ) {
                expected = {
                        "ajax": true,
                        "appendChecked": false,
+                       "boxSizing": false,
+                       "boxSizingReliable": true,
                        "changeBubbles": false,
                        "checkClone": false,
                        "checkOn": true,
+                       "clearCloneStyle": true,
                        "cors": false,
                        "cssFloat": false,
                        "deleteExpando": false,
@@ -244,143 +268,152 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
                        "html5Clone": false,
                        "htmlSerialize": false,
                        "inlineBlockNeedsLayout": true,
+                       "input": false,
                        "leadingWhitespace": false,
                        "noCloneChecked": false,
                        "noCloneEvent": false,
                        "opacity": false,
                        "optDisabled": true,
                        "optSelected": false,
+                       "ownLast": true,
+                       "pixelPosition": false,
                        "radioValue": false,
                        "reliableHiddenOffsets": false,
                        "reliableMarginRight": true,
                        "shrinkWrapBlocks": false,
-                       "submitBubbles": false,
-                       "tbody": false,
                        "style": false,
-                       "clearCloneStyle": true,
-                       "ownLast": true,
-                       "boxSizing": false,
-                       "boxSizingReliable": true,
-                       "pixelPosition": false
+                       "submitBubbles": false,
+                       "tbody": false
                };
        } else if ( /msie 6\.0/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": false,
-                       "tbody": false,
-                       "htmlSerialize": false,
-                       "style": false,
-                       "hrefNormalized": false,
-                       "opacity": false,
-                       "cssFloat": false,
+                       "ajax": true,
+                       "appendChecked": false,
+                       "boxSizing": false,
+                       "boxSizingReliable": true,
+                       "changeBubbles": false,
+                       "checkClone": false,
                        "checkOn": true,
-                       "optSelected": false,
-                       "getSetAttribute": false,
+                       "clearCloneStyle": true,
+                       "cors": false,
+                       "cssFloat": false,
+                       "deleteExpando": false,
                        "enctype": true,
-                       "html5Clone": false,
-                       "submitBubbles": false,
-                       "changeBubbles": false,
                        "focusinBubbles": true,
-                       "deleteExpando": false,
-                       "noCloneEvent": false,
+                       "getSetAttribute": false,
+                       "hrefNormalized": false,
+                       "html5Clone": false,
+                       "htmlSerialize": false,
                        "inlineBlockNeedsLayout": true,
-                       "shrinkWrapBlocks": true,
-                       "reliableMarginRight": true,
+                       "input": false,
+                       "leadingWhitespace": false,
                        "noCloneChecked": false,
+                       "noCloneEvent": false,
+                       "opacity": false,
                        "optDisabled": true,
+                       "optSelected": false,
+                       "ownLast": true,
+                       "pixelPosition": false,
                        "radioValue": false,
-                       "checkClone": false,
-                       "appendChecked": false,
                        "reliableHiddenOffsets": false,
-                       "ajax": true,
-                       "cors": false,
-                       "clearCloneStyle": true,
-                       "ownLast": true,
-                       "boxSizing": false,
-                       "boxSizingReliable": true,
-                       "pixelPosition": false
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": true,
+                       "style": false,
+                       "submitBubbles": false,
+                       "tbody": false
                };
-       } else if ( /5\.1\.1 safari/i.test( userAgent ) ) {
+       } else if ( /6\.0\.\d+ safari/i.test( userAgent ) ) {
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": true,
+                       "changeBubbles": true,
+                       "checkClone": true,
+                       "checkOn": true,
+                       "clearCloneStyle": true,
+                       "cors": true,
                        "cssFloat": true,
-                       "checkOn": false,
-                       "optSelected": true,
-                       "getSetAttribute": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": false,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": true,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": true,
+                       "ownLast": false,
+                       "pixelPosition": false,
                        "radioValue": true,
-                       "checkClone": false,
-                       "appendChecked": false,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": true,
-                       "clearCloneStyle": true,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": true,
-                       "pixelPosition": false
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        } else if ( /firefox/i.test( userAgent ) ) {
-               version = userAgent.match( /firefox\/(\d+)/i )[ 1 ];
                expected = {
-                       "leadingWhitespace": true,
-                       "tbody": true,
-                       "htmlSerialize": true,
-                       "style": true,
-                       "hrefNormalized": true,
-                       "opacity": true,
-                       "cssFloat": true,
+                       "ajax": true,
+                       "appendChecked": true,
+                       "boxSizing": true,
+                       "boxSizingReliable": true,
+                       "changeBubbles": true,
+                       "checkClone": true,
                        "checkOn": true,
-                       "optSelected": true,
-                       "getSetAttribute": true,
+                       "clearCloneStyle": true,
+                       "cors": true,
+                       "cssFloat": true,
+                       "deleteExpando": true,
                        "enctype": true,
-                       "html5Clone": true,
-                       "submitBubbles": true,
-                       "changeBubbles": true,
                        "focusinBubbles": false,
-                       "deleteExpando": true,
-                       "noCloneEvent": true,
+                       "getSetAttribute": true,
+                       "hrefNormalized": true,
+                       "html5Clone": true,
+                       "htmlSerialize": true,
                        "inlineBlockNeedsLayout": false,
-                       "shrinkWrapBlocks": false,
-                       "reliableMarginRight": true,
+                       "input": true,
+                       "leadingWhitespace": true,
                        "noCloneChecked": true,
+                       "noCloneEvent": true,
+                       "opacity": true,
                        "optDisabled": true,
+                       "optSelected": true,
+                       "ownLast": false,
+                       "pixelPosition": true,
                        "radioValue": true,
-                       "checkClone": true,
-                       "appendChecked": true,
                        "reliableHiddenOffsets": true,
-                       "ajax": true,
-                       "cors": true,
-                       "clearCloneStyle": true,
-                       "ownLast": false,
-                       "boxSizing": true,
-                       "boxSizingReliable": version >= 23,
-                       "pixelPosition": true
+                       "reliableMarginRight": true,
+                       "shrinkWrapBlocks": false,
+                       "style": true,
+                       "submitBubbles": true,
+                       "tbody": true
                };
        }
 
        if ( expected ) {
                test( "Verify that the support tests resolve as expected per browser", function() {
-                       expect( 33 );
+                       var i, prop,
+                               j = 0;
+
+                       for ( prop in computedSupport ) {
+                               j++;
+                       }
+
+                       expect( j );
 
-                       for ( var i in expected ) {
+                       for ( i in expected ) {
                                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 {
                                        ok( true, "no ajax; skipping jQuery.support['" + i + "']" );
                                }
@@ -390,13 +423,10 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
 
 })();
 
-// Support: Safari 5.1
-// Shameless browser-sniff, but Safari 5.1 mishandles CSP
-if ( !( typeof navigator !== "undefined" &&
-       (/ 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 ) {
+testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
+       "support/csp.php",
+       function( support ) {
                expect( 1 );
-               deepEqual( jQuery.extend( {}, support ), jQuery.support, "No violations of CSP polices" );
-       });
-}
+               deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" );
+       }
+);