diff options
author | Michał Gołębiowski <m.goleb@gmail.com> | 2014-11-03 19:53:22 +0100 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2014-12-08 21:12:33 +0100 |
commit | 90d7cc1d8b2ea7ac75f0eacb42439349c9c73278 (patch) | |
tree | 3302e3fce03076b1fe3e91eedba671be42bade69 /src | |
parent | a467f8653a6fab2903148df80ab0ce9f5f4fd04f (diff) | |
download | jquery-90d7cc1d8b2ea7ac75f0eacb42439349c9c73278.tar.gz jquery-90d7cc1d8b2ea7ac75f0eacb42439349c9c73278.zip |
Misc: Drop support for older browsers; update support comments
That includes IE<8, Opera 12.x, Firefox<29, Safari<6.0 and some hacks
for old Blackberry.
Fixes gh-1836
Fixes gh-1701
Refs gh-1815
Refs gh-1820
Diffstat (limited to 'src')
-rw-r--r-- | src/.jshintrc | 1 | ||||
-rw-r--r-- | src/ajax.js | 30 | ||||
-rw-r--r-- | src/ajax/parseJSON.js | 44 | ||||
-rw-r--r-- | src/ajax/script.js | 3 | ||||
-rw-r--r-- | src/ajax/xhr.js | 8 | ||||
-rw-r--r-- | src/attributes/attr.js | 100 | ||||
-rw-r--r-- | src/attributes/prop.js | 21 | ||||
-rw-r--r-- | src/attributes/support.js | 17 | ||||
-rw-r--r-- | src/attributes/val.js | 26 | ||||
-rw-r--r-- | src/core.js | 4 | ||||
-rw-r--r-- | src/core/init.js | 16 | ||||
-rw-r--r-- | src/core/ready.js | 34 | ||||
-rw-r--r-- | src/css.js | 15 | ||||
-rw-r--r-- | src/css/curCSS.js | 13 | ||||
-rw-r--r-- | src/css/hiddenVisibleSelectors.js | 4 | ||||
-rw-r--r-- | src/css/support.js | 23 | ||||
-rw-r--r-- | src/dimensions.js | 2 | ||||
-rw-r--r-- | src/effects.js | 27 | ||||
-rw-r--r-- | src/effects/support.js | 54 | ||||
-rw-r--r-- | src/event.js | 7 | ||||
-rw-r--r-- | src/manipulation.js | 84 | ||||
-rw-r--r-- | src/manipulation/support.js | 23 | ||||
-rw-r--r-- | src/offset.js | 6 | ||||
-rw-r--r-- | src/support.js | 38 |
24 files changed, 101 insertions, 499 deletions
diff --git a/src/.jshintrc b/src/.jshintrc index 10541d501..3ffebfd5a 100644 --- a/src/.jshintrc +++ b/src/.jshintrc @@ -13,7 +13,6 @@ "undef": true, "unused": true, - "evil": true, "sub": true, "es3": true, diff --git a/src/ajax.js b/src/ajax.js index d44a76095..d4a0128b4 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -10,10 +10,6 @@ define([ ], function( jQuery, rnotwhite, nonce, rquery ) { var - // Document location - ajaxLocParts, - ajaxLocation, - rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL @@ -42,23 +38,13 @@ var transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); - -// Support: IE<8 -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch ( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} + allTypes = "*/".concat( "*" ), + + // Document location + ajaxLocation = location.href, -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + // Segment location into parts + ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { @@ -79,7 +65,7 @@ function addToPrefiltersOrTransports( structure ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested - if ( dataType.charAt( 0 ) === "+" ) { + if ( dataType[ 0 ] === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); @@ -509,7 +495,7 @@ jQuery.extend({ jqXHR.error = jqXHR.fail; // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // Add protocol if not provided (prefilters might expect it) // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || ajaxLocation ) + "" ) diff --git a/src/ajax/parseJSON.js b/src/ajax/parseJSON.js index 69b5c837d..3a96d15b9 100644 --- a/src/ajax/parseJSON.js +++ b/src/ajax/parseJSON.js @@ -2,48 +2,10 @@ define([ "../core" ], function( jQuery ) { -var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; - +// Support: Android 2.3 +// Workaround failure to string-cast null input jQuery.parseJSON = function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - // Support: Android 2.3 - // Workaround failure to string-cast null input - return window.JSON.parse( data + "" ); - } - - var requireNonComma, - depth = null, - str = jQuery.trim( data + "" ); - - // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains - // after removing valid tokens - return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { - - // Force termination if we see a misplaced comma - if ( requireNonComma && comma ) { - depth = 0; - } - - // Perform no more replacements after returning to outermost depth - if ( depth === 0 ) { - return token; - } - - // Commas must not follow "[", "{", or "," - requireNonComma = open || comma; - - // Determine new depth - // array/object open ("[" or "{"): depth += true - false (increment) - // array/object close ("]" or "}"): depth += false - true (decrement) - // other cases ("," or primitive): depth += true - true (numeric cast) - depth += !close - !open; - - // Remove this token - return ""; - }) ) ? - ( Function( "return " + str ) )() : - jQuery.error( "Invalid JSON: " + data ); + return JSON.parse( data + "" ); }; return jQuery.parseJSON; diff --git a/src/ajax/script.js b/src/ajax/script.js index 416a45ddb..be422adf3 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -77,9 +77,8 @@ jQuery.ajaxTransport( "script", function(s) { } }; - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); + head.appendChild( script ); }, abort: function() { diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 149c49e5d..ac5bc81d9 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -7,13 +7,13 @@ define([ // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? - // Support: IE6+ + // Support: IE8 function() { // XHR cannot access local files, always use ActiveX for that case return !this.isLocal && - // Support: IE7-8 + // Support: IE<9 // oldIE XHR does not support non-RFC2616 methods (#13240) // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 @@ -167,10 +167,6 @@ if ( xhrSupported ) { if ( !options.async ) { // if we're in sync mode we fire the callback callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback ); } else { // Add to the list of active xhr callbacks xhr.onreadystatechange = xhrCallbacks[ id ] = callback; diff --git a/src/attributes/attr.js b/src/attributes/attr.js index 4d8abf320..9c962ef2d 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -7,10 +7,9 @@ define([ "../selector" ], function( jQuery, rnotwhite, access, support ) { -var nodeHook, boolHook, +var boolHook, attrHandle = jQuery.expr.attrHandle, ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = support.getSetAttribute, getSetInput = support.input; jQuery.fn.extend({ @@ -45,7 +44,7 @@ jQuery.extend({ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); } if ( value !== undefined ) { @@ -88,7 +87,7 @@ jQuery.extend({ // Boolean attributes get special treatment (#10870) if ( jQuery.expr.match.bool.test( name ) ) { // Set corresponding property to false - if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + if ( getSetInput || !ruseDefault.test( name ) ) { elem[ propName ] = false; // Support: IE<9 // Also clear defaultChecked/defaultSelected (if appropriate) @@ -96,13 +95,9 @@ jQuery.extend({ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ propName ] = false; } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); } - elem.removeAttribute( getSetAttribute ? name : propName ); + elem.removeAttribute( name ); } } }, @@ -111,7 +106,7 @@ jQuery.extend({ type: { set: function( elem, value ) { if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 + // Setting the type on a radio button after the value resets the value in IE8-9 // Reset value to default in case type is set after value during creation var val = elem.value; elem.setAttribute( "type", value ); @@ -131,12 +126,12 @@ boolHook = { if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + } else if ( getSetInput || !ruseDefault.test( name ) ) { + elem.setAttribute( jQuery.propFix[ name ] || name, name ); - // Use defaultChecked and defaultSelected for oldIE } else { + // Support: IE<9 + // Use defaultChecked and defaultSelected for oldIE elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } @@ -149,7 +144,7 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) var getter = attrHandle[ name ] || jQuery.find.attr; - attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? + attrHandle[ name ] = getSetInput || !ruseDefault.test( name ) ? function( elem, name, isXML ) { var ret, handle; if ( !isXML ) { @@ -173,86 +168,15 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) }); // fix oldIE attroperties -if ( !getSetInput || !getSetAttribute ) { +if ( !getSetInput ) { jQuery.attrHooks.value = { - set: function( elem, value, name ) { + set: function( elem, value ) { if ( jQuery.nodeName( elem, "input" ) ) { // Does not return so that setAttribute is also used elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = { - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - if ( name === "value" || value === elem.getAttribute( name ) ) { - return value; - } - } - }; - - // Some attributes are constructed with empty-string values when not defined - attrHandle.id = attrHandle.name = attrHandle.coords = - function( elem, name, isXML ) { - var ret; - if ( !isXML ) { - return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? - ret.value : - null; } - }; - - // Fixing value retrieval on a button requires this module - jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - if ( ret && ret.specified ) { - return ret.value; - } - }, - set: nodeHook.set - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); } }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }; - }); } if ( !support.style ) { diff --git a/src/attributes/prop.js b/src/attributes/prop.js index 92fa8c3b3..991e509c2 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -80,22 +80,6 @@ jQuery.extend({ } }); -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !support.hrefNormalized ) { - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -// Support: Safari, IE9+ -// mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it if ( !support.optSelected ) { jQuery.propHooks.selected = { get: function( elem ) { @@ -129,9 +113,4 @@ jQuery.each([ jQuery.propFix[ this.toLowerCase() ] = this; }); -// IE6/7 call enctype encoding -if ( !support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - }); diff --git a/src/attributes/support.js b/src/attributes/support.js index 665e836f6..044e23823 100644 --- a/src/attributes/support.js +++ b/src/attributes/support.js @@ -8,8 +8,7 @@ define([ // Setup div = document.createElement( "div" ); - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + div.innerHTML = " <link/><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName("a")[ 0 ]; // First batch of tests. @@ -19,28 +18,18 @@ define([ 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; + // Support: IE8-11+ // 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) + // (IE defaults to false instead of true 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; diff --git a/src/attributes/val.js b/src/attributes/val.js index c51a1a3b8..d9dd836cb 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -96,7 +96,8 @@ jQuery.extend({ for ( ; i < max; i++ ) { option = options[ i ]; - // oldIE doesn't update selected after form reset (#2551) + // Support: IE<10 + // IE8-9 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 ( support.optDisabled ? @@ -129,24 +130,9 @@ jQuery.extend({ while ( i-- ) { option = options[ i ]; - - if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { - - // Support: IE6 - // When new option element is added to select box we need to - // force reflow of newly added node in order to workaround delay - // of initialization properties - try { - option.selected = optionSet = true; - - } catch ( _ ) { - - // Will be executed only in IE6 - option.scrollHeight; - } - - } else { - option.selected = false; + if ( (option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0) ) { + optionSet = true; } } @@ -172,8 +158,6 @@ jQuery.each([ "radio", "checkbox" ], function() { }; if ( !support.checkOn ) { jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; }; } diff --git a/src/core.js b/src/core.js index 27162f84a..5251dc639 100644 --- a/src/core.js +++ b/src/core.js @@ -285,9 +285,7 @@ jQuery.extend({ script.text = data; - // Support: IE6 - // Circumvent bugs with base elements (#2709 and #4378) by prepending - head.insertBefore( script, head.firstChild ); + head.appendChild( script ); head.removeChild( script ); }, diff --git a/src/core/init.js b/src/core/init.js index c0f50d0c0..94f95391b 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -27,8 +27,8 @@ var rootjQuery, // Handle HTML strings if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && - selector.charAt( selector.length - 1 ) === ">" && + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check @@ -73,16 +73,8 @@ var rootjQuery, } else { elem = document.getElementById( match[2] ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object + if ( elem ) { + // Inject the element directly into the jQuery object this.length = 1; this[0] = elem; } diff --git a/src/core/ready.js b/src/core/ready.js index 095e6daeb..10bebf648 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -71,6 +71,7 @@ function detach() { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); + // Support: IE<9 } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); @@ -114,6 +115,7 @@ jQuery.ready.promise = function( obj ) { // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); + // Support: IE<9 // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes @@ -121,38 +123,12 @@ jQuery.ready.promise = function( obj ) { // A fallback to window.onload, that will always work window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch ( e ) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch ( e ) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } } } return readyList.promise( obj ); }; +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); + }); diff --git a/src/css.js b/src/css.js index c434fd1b7..a12a87408 100644 --- a/src/css.js +++ b/src/css.js @@ -38,7 +38,7 @@ var fontWeight: "400" }, - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + cssPrefixes = [ "Webkit", "Moz", "ms" ]; // BuildExclude curCSS = curCSS.curCSS; @@ -52,7 +52,7 @@ function vendorPropName( style, name ) { } // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), origName = name, i = cssPrefixes.length; @@ -174,8 +174,7 @@ function getWidthOrHeight( elem, name, extra ) { var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), - isBorderBox = support.boxSizing && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 @@ -302,7 +301,7 @@ jQuery.extend({ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - // Support: IE + // Support: IE<9 // Swallow errors from 'invalid' CSS values (#5509) try { style[ name ] = value; @@ -380,8 +379,7 @@ jQuery.each([ "height", "width" ], function( i, name ) { elem, name, extra, - support.boxSizing && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ) : 0 ); @@ -437,11 +435,10 @@ if ( !support.opacity ) { }; } +// Support: Android 2.3 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 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" ] ); } diff --git a/src/css/curCSS.js b/src/css/curCSS.js index 66602cc80..0b8f25997 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -36,12 +36,11 @@ if ( window.getComputedStyle ) { ret = jQuery.style( elem, name ); } + // Support: Android 4.0-4.3 // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" - // instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, - // but width seems to be reliably pixels - // this is against the CSSOM draft spec: + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: // http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { @@ -61,7 +60,7 @@ if ( window.getComputedStyle ) { } } - // Support: IE + // Support: IE9-11+ // IE returns zIndex value as an integer. return ret === undefined ? ret : @@ -115,7 +114,7 @@ if ( window.getComputedStyle ) { } } - // Support: IE + // Support: IE<9 // IE returns zIndex value as an integer. return ret === undefined ? ret : diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index 027fd179d..9f27b8b9e 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -6,11 +6,9 @@ define([ ], function( jQuery, support ) { jQuery.expr.filters.hidden = function( elem ) { - // Support: Opera <= 12.12 - // Opera reports offsetWidths and offsetHeights less than zero on some elements // Use OR instead of AND as the element is not visible if either is true // See tickets #10406 and #13132 - return elem.offsetWidth <= 0 || elem.offsetHeight <= 0 || + return !elem.offsetWidth || !elem.offsetHeight || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); }; diff --git a/src/css/support.js b/src/css/support.js index 05f5cc866..e8f8dd4b7 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -33,11 +33,6 @@ define([ div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; - // Support: Firefox<29, Android 2.3 - // Vendor-prefix box-sizing - support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || - style.WebkitBoxSizing === ""; - jQuery.extend(support, { reliableHiddenOffsets: function() { if ( reliableHiddenOffsetsVal == null ) { @@ -71,9 +66,9 @@ define([ function computeStyleTests() { // Minified: var b,c,d,j - var div, body, container, contents; + var div, container, contents, + body = document.body; - body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Test fired too early or in an unsupported environment, exit. return; @@ -86,10 +81,10 @@ define([ body.appendChild( container ).appendChild( div ); div.style.cssText = - // Support: Firefox<29, Android 2.3 + // Support: Android 2.3 // Vendor-prefix box-sizing - "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + - "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + + "-webkit-box-sizing:border-box;box-sizing:border-box;" + + "display:block;margin-top:1%;top:1%;" + "border:1px;padding:1px;width:4px;position:absolute"; // Support: IE<9 @@ -111,10 +106,10 @@ define([ // Reset CSS: box-sizing; display; margin; border; padding contents.style.cssText = div.style.cssText = - // Support: Firefox<29, Android 2.3 + // Support: Android 2.3 // Vendor-prefix box-sizing - "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + - "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; + "-webkit-box-sizing:content-box;box-sizing:content-box;" + + "display:block;margin:0;border:0;padding:0"; contents.style.marginRight = contents.style.width = "0"; div.style.width = "1px"; @@ -124,7 +119,7 @@ define([ div.removeChild( contents ); } - // Support: IE8 + // Support: IE<9 // 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 diff --git a/src/dimensions.js b/src/dimensions.js index 95f327b0f..08bf60ee0 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -29,7 +29,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], // whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, + // unfortunately, this causes bug #3838 in IE8 only, // but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], diff --git a/src/effects.js b/src/effects.js index 189658163..42a9684b8 100644 --- a/src/effects.js +++ b/src/effects.js @@ -4,7 +4,6 @@ define([ "./css/var/cssExpand", "./css/var/isHidden", "./css/defaultDisplay", - "./effects/support", "./core/init", "./effects/Tween", @@ -12,7 +11,7 @@ define([ "./css", "./deferred", "./traversing" -], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay, support ) { +], function( jQuery, pnum, cssExpand, isHidden, defaultDisplay ) { var fxNow, timerId, @@ -177,26 +176,17 @@ function defaultPrefilter( elem, props, opts ) { jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; - } else { - style.zoom = 1; - } + style.display = "inline-block"; } } if ( opts.overflow ) { style.overflow = "hidden"; - if ( !support.shrinkWrapBlocks() ) { - anim.always(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } + anim.always(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); } // show/hide pass @@ -320,7 +310,8 @@ function Animation( elem, properties, options ) { } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + // Support: Android 2.3 + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, diff --git a/src/effects/support.js b/src/effects/support.js deleted file mode 100644 index c3ba17b5f..000000000 --- a/src/effects/support.js +++ /dev/null @@ -1,54 +0,0 @@ -define([ - "../var/support" -], function( support ) { - -(function() { - var shrinkWrapBlocksVal; - - support.shrinkWrapBlocks = function() { - if ( shrinkWrapBlocksVal != null ) { - return shrinkWrapBlocksVal; - } - - // Will be changed later if needed. - shrinkWrapBlocksVal = false; - - // Minified: var b,c,d - var div, body, container; - - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body || !body.style ) { - // Test fired too early or in an unsupported environment, exit. - return; - } - - // Setup - div = document.createElement( "div" ); - container = document.createElement( "div" ); - container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; - body.appendChild( container ).appendChild( div ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - if ( typeof div.style.zoom !== "undefined" ) { - // Reset CSS: box-sizing; display; margin; border - div.style.cssText = - // Support: Firefox<29, Android 2.3 - // Vendor-prefix box-sizing - "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + - "box-sizing:content-box;display:block;margin:0;border:0;" + - "padding:1px;width:1px;zoom:1"; - div.appendChild( document.createElement( "div" ) ).style.width = "5px"; - shrinkWrapBlocksVal = div.offsetWidth !== 3; - } - - body.removeChild( container ); - - return shrinkWrapBlocksVal; - }; - -})(); - -return support; - -}); diff --git a/src/event.js b/src/event.js index f6759fd5f..ce8b71e30 100644 --- a/src/event.js +++ b/src/event.js @@ -340,8 +340,9 @@ jQuery.event = { jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) + // Support: IE<9 + // Can't use an .isFunction() check here because IE8 fails that test. if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method @@ -514,7 +515,7 @@ jQuery.event = { event.target = originalEvent.srcElement || document; } - // Support: Chrome 23+, Safari? + // Support: Safari 6.0+ // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; @@ -677,7 +678,7 @@ jQuery.removeEvent = document.removeEventListener ? if ( elem.detachEvent ) { - // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // #8545, #7054, preventing memory leaks for custom events in IE8 // detachEvent needed property on element, by name of that event, // to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { diff --git a/src/manipulation.js b/src/manipulation.js index 63fa1088d..003d05fe0 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -36,7 +36,6 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, // checked="checked" or checked @@ -56,7 +55,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // IE8 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: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] }, @@ -91,14 +90,6 @@ function getAll( context, tag ) { found; } -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -// Support: IE<8 // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && @@ -175,7 +166,6 @@ function fixCloneNodeIssues( src, dest ) { nodeName = dest.nodeName.toLowerCase(); - // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); @@ -187,45 +177,26 @@ function fixCloneNodeIssues( src, dest ) { dest.removeAttribute( jQuery.expando ); } + // Support: IE<9 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // 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 ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - + // Support: IE<9 + // IE8 fails to persist the checked state of a cloned checkbox + // or radio button. } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } + dest.checked = src.checked; - // IE6-8 fails to return the selected option to the default selected + // Support: IE<9 + // IE8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; - // IE6-8 fails to set the defaultValue to the correct value when + // Support: IE<9 + // IE8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; @@ -292,7 +263,7 @@ jQuery.extend({ buildFragment: function( elems, context, scripts, selection ) { var j, elem, contains, - tmp, tag, tbody, wrap, + tmp, tag, wrap, l = elems.length, // Ensure a safe fragment @@ -335,28 +306,6 @@ jQuery.extend({ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); } - // Remove IE's autoinserted <tbody> from table fragments - if ( !support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && - !tbody.childNodes.length ) { - - elem.removeChild( tbody ); - } - } - } - jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 @@ -378,12 +327,6 @@ jQuery.extend({ safe.removeChild( tmp ); } - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - i = 0; while ( (elem = nodes[ i++ ]) ) { @@ -687,6 +630,8 @@ jQuery.fn.extend({ // Keep references to cloned scripts for later restoration if ( hasScripts ) { + // Support: Android<4.1, PhantomJS<2 + // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } } @@ -749,7 +694,8 @@ jQuery.each({ elems = i === last ? this : this.clone(true); jQuery( insert[i] )[ original ]( elems ); - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + // Support: IE<9, Android<4.1, PhantomJS<2 + // .get() because push.apply(_, arraylike) throws on ancient WebKit push.apply( ret, elems.get() ); } diff --git a/src/manipulation/support.js b/src/manipulation/support.js index 3ac54f4bb..27e0fb1de 100644 --- a/src/manipulation/support.js +++ b/src/manipulation/support.js @@ -3,21 +3,15 @@ define([ ], function( support ) { (function() { - // Minified: var a,b,c - var input = document.createElement( "input" ), - div = document.createElement( "div" ), + var div = document.createElement( "div" ), fragment = document.createDocumentFragment(); // Setup - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + div.innerHTML = " <link/><a href='/a'></a>"; // 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; @@ -27,15 +21,8 @@ define([ support.html5Clone = document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - input.type = "checkbox"; - input.checked = true; - fragment.appendChild( input ); - support.appendChecked = input.checked; - // Make sure textarea (and checkbox) defaultValue is properly cloned - // Support: IE6-IE11+ + // Support: IE8-IE11+ div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; @@ -43,8 +30,8 @@ define([ fragment.appendChild( div ); div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments + // Support: Android<4.2 + // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 diff --git a/src/offset.js b/src/offset.js index eb3c1f119..37d7c34cf 100644 --- a/src/offset.js +++ b/src/offset.js @@ -103,11 +103,7 @@ jQuery.fn.extend({ return box; } - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== "undefined" ) { - box = elem.getBoundingClientRect(); - } + box = elem.getBoundingClientRect(); win = getWindow( doc ); return { top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), diff --git a/src/support.js b/src/support.js index 49cbd2a21..cb5386a7b 100644 --- a/src/support.js +++ b/src/support.js @@ -15,43 +15,5 @@ for ( i in jQuery( support ) ) { support.ownLast = i !== "0"; // Note: most support tests are defined in their respective modules. -// false until the test is run -support.inlineBlockNeedsLayout = false; - -// Execute ASAP in case we need to set body.style.zoom -jQuery(function() { - // Minified: var a,b,c,d - var val, div, body, container; - - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body || !body.style ) { - // Return for frameset docs that don't have a body - return; - } - - // Setup - div = document.createElement( "div" ); - container = document.createElement( "div" ); - container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; - body.appendChild( container ).appendChild( div ); - - if ( typeof div.style.zoom !== "undefined" ) { - // 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.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; - - support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; - if ( val ) { - // 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.removeChild( container ); -}); }); |