Skip to content

Commit

Permalink
Misc: Drop support for older browsers; update support comments
Browse files Browse the repository at this point in the history
That includes IE<8, Opera 12.x, Firefox<29, Safari<6.0 and some hacks
for old Blackberry.

Fixes jquerygh-1835
Fixes jquerygh-1701
Refs jquerygh-1815
Refs jquerygh-1820
  • Loading branch information
mgol committed Nov 4, 2014
1 parent b7663ea commit 63204e3
Show file tree
Hide file tree
Showing 38 changed files with 209 additions and 941 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In the spirit of open source software development, jQuery always encourages comm
Environments in which to use jQuery
--------------------------------------

- [Browser support](http://jquery.com/browser-support/) differs between the master branch and the compat branch. Specifically, the master branch does not support legacy browsers such as IE6-8. The jQuery team continues to provide support for legacy browsers on the compat branch. Use the latest compat release if support for those browsers is required. See [browser support](http://jquery.com/browser-support/) for more info.
- [Browser support](http://jquery.com/browser-support/) differs between the master branch and the compat branch. Specifically, the master branch does not support legacy browsers such as IE8. The jQuery team continues to provide support for legacy browsers on the compat branch. Use the latest compat release if support for those browsers is required. See [browser support](http://jquery.com/browser-support/) for more info.
- To use jQuery in Node, browser extensions, and other non-browser environments, use only master branch releases given the name "jquery" rather than "jquery-compat". The compat branch does not support these environments.


Expand Down
4 changes: 2 additions & 2 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");

// Support: IE<8
// Support: IE8
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
Expand Down Expand Up @@ -509,7 +509,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 ) + "" )
Expand Down
4 changes: 1 addition & 3 deletions src/ajax/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ 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() {
Expand Down
8 changes: 2 additions & 6 deletions src/ajax/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: IE8
// 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
Expand Down Expand Up @@ -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;
Expand Down
90 changes: 8 additions & 82 deletions src/attributes/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ define([
var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = support.getSetAttribute,
getSetInput = support.input;

jQuery.fn.extend({
Expand Down Expand Up @@ -88,21 +87,17 @@ 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)
} else {
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 );
}
}
},
Expand All @@ -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 );
Expand All @@ -131,12 +126,11 @@ 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 {
// Use defaultChecked and defaultSelected for oldIE
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}

Expand All @@ -149,7 +143,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 ) {
Expand All @@ -173,7 +167,7 @@ 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 ) {
if ( jQuery.nodeName( elem, "input" ) ) {
Expand All @@ -187,74 +181,6 @@ if ( !getSetInput || !getSetAttribute ) {
};
}

// 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 ) {
jQuery.attrHooks.style = {
get: function( elem ) {
Expand Down
18 changes: 0 additions & 18 deletions src/attributes/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +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
Expand Down Expand Up @@ -129,9 +116,4 @@ jQuery.each([
jQuery.propFix[ this.toLowerCase() ] = this;
});

// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}

});
14 changes: 1 addition & 13 deletions src/attributes/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -19,28 +18,17 @@ 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;

// 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;
Expand Down
22 changes: 2 additions & 20 deletions src/attributes/val.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,8 @@ 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( option.value, values ) >= 0) ) {
optionSet = true;
}
}

Expand All @@ -172,8 +156,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;
};
}
Expand Down
4 changes: 1 addition & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
},

Expand Down
10 changes: 1 addition & 9 deletions src/core/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,7 @@ 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 );
}

if ( elem ) {
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
Expand Down
11 changes: 5 additions & 6 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var
fontWeight: "400"
},

cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
cssPrefixes = [ "Webkit", "Moz", "ms" ];

// BuildExclude
curCSS = curCSS.curCSS;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -302,7 +301,7 @@ jQuery.extend({
if ( !hooks || !("set" in hooks) ||
(value = hooks.set( elem, value, extra )) !== undefined ) {

// Support: IE
// Support: IE8
// Swallow errors from 'invalid' CSS values (#5509)
try {
style[ name ] = value;
Expand Down Expand Up @@ -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
);
Expand Down Expand Up @@ -437,6 +435,7 @@ if ( !support.opacity ) {
};
}

// Support: Android 2.3
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) {
if ( computed ) {
Expand Down
Loading

0 comments on commit 63204e3

Please sign in to comment.