Skip to content

Commit 90d7cc1

Browse files
committed
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
1 parent a467f86 commit 90d7cc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+254
-1075
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In the spirit of open source software development, jQuery always encourages comm
1414
Environments in which to use jQuery
1515
--------------------------------------
1616

17-
- [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.
17+
- [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.
1818
- 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.
1919

2020

src/.jshintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"undef": true,
1414
"unused": true,
1515

16-
"evil": true,
1716
"sub": true,
1817

1918
"es3": true,

src/ajax.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ define([
1010
], function( jQuery, rnotwhite, nonce, rquery ) {
1111

1212
var
13-
// Document location
14-
ajaxLocParts,
15-
ajaxLocation,
16-
1713
rhash = /#.*$/,
1814
rts = /([?&])_=[^&]*/,
1915
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
@@ -42,23 +38,13 @@ var
4238
transports = {},
4339

4440
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
45-
allTypes = "*/".concat("*");
46-
47-
// Support: IE<8
48-
// #8138, IE may throw an exception when accessing
49-
// a field from window.location if document.domain has been set
50-
try {
51-
ajaxLocation = location.href;
52-
} catch ( e ) {
53-
// Use the href attribute of an A element
54-
// since IE will modify it given document.location
55-
ajaxLocation = document.createElement( "a" );
56-
ajaxLocation.href = "";
57-
ajaxLocation = ajaxLocation.href;
58-
}
41+
allTypes = "*/".concat( "*" ),
42+
43+
// Document location
44+
ajaxLocation = location.href,
5945

60-
// Segment location into parts
61-
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
46+
// Segment location into parts
47+
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
6248

6349
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6450
function addToPrefiltersOrTransports( structure ) {
@@ -79,7 +65,7 @@ function addToPrefiltersOrTransports( structure ) {
7965
// For each dataType in the dataTypeExpression
8066
while ( (dataType = dataTypes[i++]) ) {
8167
// Prepend if requested
82-
if ( dataType.charAt( 0 ) === "+" ) {
68+
if ( dataType[ 0 ] === "+" ) {
8369
dataType = dataType.slice( 1 ) || "*";
8470
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
8571

@@ -509,7 +495,7 @@ jQuery.extend({
509495
jqXHR.error = jqXHR.fail;
510496

511497
// Remove hash character (#7531: and string promotion)
512-
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
498+
// Add protocol if not provided (prefilters might expect it)
513499
// Handle falsy url in the settings object (#10093: consistency with old signature)
514500
// We also use the url parameter if available
515501
s.url = ( ( url || s.url || ajaxLocation ) + "" )

src/ajax/parseJSON.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,10 @@ define([
22
"../core"
33
], function( jQuery ) {
44

5-
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
6-
5+
// Support: Android 2.3
6+
// Workaround failure to string-cast null input
77
jQuery.parseJSON = function( data ) {
8-
// Attempt to parse using the native JSON parser first
9-
if ( window.JSON && window.JSON.parse ) {
10-
// Support: Android 2.3
11-
// Workaround failure to string-cast null input
12-
return window.JSON.parse( data + "" );
13-
}
14-
15-
var requireNonComma,
16-
depth = null,
17-
str = jQuery.trim( data + "" );
18-
19-
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
20-
// after removing valid tokens
21-
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
22-
23-
// Force termination if we see a misplaced comma
24-
if ( requireNonComma && comma ) {
25-
depth = 0;
26-
}
27-
28-
// Perform no more replacements after returning to outermost depth
29-
if ( depth === 0 ) {
30-
return token;
31-
}
32-
33-
// Commas must not follow "[", "{", or ","
34-
requireNonComma = open || comma;
35-
36-
// Determine new depth
37-
// array/object open ("[" or "{"): depth += true - false (increment)
38-
// array/object close ("]" or "}"): depth += false - true (decrement)
39-
// other cases ("," or primitive): depth += true - true (numeric cast)
40-
depth += !close - !open;
41-
42-
// Remove this token
43-
return "";
44-
}) ) ?
45-
( Function( "return " + str ) )() :
46-
jQuery.error( "Invalid JSON: " + data );
8+
return JSON.parse( data + "" );
479
};
4810

4911
return jQuery.parseJSON;

src/ajax/script.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ jQuery.ajaxTransport( "script", function(s) {
7777
}
7878
};
7979

80-
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
8180
// Use native DOM manipulation to avoid our domManip AJAX trickery
82-
head.insertBefore( script, head.firstChild );
81+
head.appendChild( script );
8382
},
8483

8584
abort: function() {

src/ajax/xhr.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ define([
77
// Create the request object
88
// (This is still attached to ajaxSettings for backward compatibility)
99
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
10-
// Support: IE6+
10+
// Support: IE8
1111
function() {
1212

1313
// XHR cannot access local files, always use ActiveX for that case
1414
return !this.isLocal &&
1515

16-
// Support: IE7-8
16+
// Support: IE<9
1717
// oldIE XHR does not support non-RFC2616 methods (#13240)
1818
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
1919
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
@@ -167,10 +167,6 @@ if ( xhrSupported ) {
167167
if ( !options.async ) {
168168
// if we're in sync mode we fire the callback
169169
callback();
170-
} else if ( xhr.readyState === 4 ) {
171-
// (IE6 & IE7) if it's in cache and has been
172-
// retrieved directly we need to fire the callback
173-
setTimeout( callback );
174170
} else {
175171
// Add to the list of active xhr callbacks
176172
xhr.onreadystatechange = xhrCallbacks[ id ] = callback;

src/attributes/attr.js

Lines changed: 12 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ define([
77
"../selector"
88
], function( jQuery, rnotwhite, access, support ) {
99

10-
var nodeHook, boolHook,
10+
var boolHook,
1111
attrHandle = jQuery.expr.attrHandle,
1212
ruseDefault = /^(?:checked|selected)$/i,
13-
getSetAttribute = support.getSetAttribute,
1413
getSetInput = support.input;
1514

1615
jQuery.fn.extend({
@@ -45,7 +44,7 @@ jQuery.extend({
4544
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
4645
name = name.toLowerCase();
4746
hooks = jQuery.attrHooks[ name ] ||
48-
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
47+
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
4948
}
5049

5150
if ( value !== undefined ) {
@@ -88,21 +87,17 @@ jQuery.extend({
8887
// Boolean attributes get special treatment (#10870)
8988
if ( jQuery.expr.match.bool.test( name ) ) {
9089
// Set corresponding property to false
91-
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
90+
if ( getSetInput || !ruseDefault.test( name ) ) {
9291
elem[ propName ] = false;
9392
// Support: IE<9
9493
// Also clear defaultChecked/defaultSelected (if appropriate)
9594
} else {
9695
elem[ jQuery.camelCase( "default-" + name ) ] =
9796
elem[ propName ] = false;
9897
}
99-
100-
// See #9699 for explanation of this approach (setting first, then removal)
101-
} else {
102-
jQuery.attr( elem, name, "" );
10398
}
10499

105-
elem.removeAttribute( getSetAttribute ? name : propName );
100+
elem.removeAttribute( name );
106101
}
107102
}
108103
},
@@ -111,7 +106,7 @@ jQuery.extend({
111106
type: {
112107
set: function( elem, value ) {
113108
if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
114-
// Setting the type on a radio button after the value resets the value in IE6-9
109+
// Setting the type on a radio button after the value resets the value in IE8-9
115110
// Reset value to default in case type is set after value during creation
116111
var val = elem.value;
117112
elem.setAttribute( "type", value );
@@ -131,12 +126,12 @@ boolHook = {
131126
if ( value === false ) {
132127
// Remove boolean attributes when set to false
133128
jQuery.removeAttr( elem, name );
134-
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
135-
// IE<8 needs the *property* name
136-
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
129+
} else if ( getSetInput || !ruseDefault.test( name ) ) {
130+
elem.setAttribute( jQuery.propFix[ name ] || name, name );
137131

138-
// Use defaultChecked and defaultSelected for oldIE
139132
} else {
133+
// Support: IE<9
134+
// Use defaultChecked and defaultSelected for oldIE
140135
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
141136
}
142137

@@ -149,7 +144,7 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
149144

150145
var getter = attrHandle[ name ] || jQuery.find.attr;
151146

152-
attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
147+
attrHandle[ name ] = getSetInput || !ruseDefault.test( name ) ?
153148
function( elem, name, isXML ) {
154149
var ret, handle;
155150
if ( !isXML ) {
@@ -173,86 +168,15 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
173168
});
174169

175170
// fix oldIE attroperties
176-
if ( !getSetInput || !getSetAttribute ) {
171+
if ( !getSetInput ) {
177172
jQuery.attrHooks.value = {
178-
set: function( elem, value, name ) {
173+
set: function( elem, value ) {
179174
if ( jQuery.nodeName( elem, "input" ) ) {
180175
// Does not return so that setAttribute is also used
181176
elem.defaultValue = value;
182-
} else {
183-
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
184-
return nodeHook && nodeHook.set( elem, value, name );
185-
}
186-
}
187-
};
188-
}
189-
190-
// IE6/7 do not support getting/setting some attributes with get/setAttribute
191-
if ( !getSetAttribute ) {
192-
193-
// Use this for any attribute in IE6/7
194-
// This fixes almost every IE6/7 issue
195-
nodeHook = {
196-
set: function( elem, value, name ) {
197-
// Set the existing or create a new attribute node
198-
var ret = elem.getAttributeNode( name );
199-
if ( !ret ) {
200-
elem.setAttributeNode(
201-
(ret = elem.ownerDocument.createAttribute( name ))
202-
);
203-
}
204-
205-
ret.value = value += "";
206-
207-
// Break association with cloned elements by also using setAttribute (#9646)
208-
if ( name === "value" || value === elem.getAttribute( name ) ) {
209-
return value;
210-
}
211-
}
212-
};
213-
214-
// Some attributes are constructed with empty-string values when not defined
215-
attrHandle.id = attrHandle.name = attrHandle.coords =
216-
function( elem, name, isXML ) {
217-
var ret;
218-
if ( !isXML ) {
219-
return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
220-
ret.value :
221-
null;
222177
}
223-
};
224-
225-
// Fixing value retrieval on a button requires this module
226-
jQuery.valHooks.button = {
227-
get: function( elem, name ) {
228-
var ret = elem.getAttributeNode( name );
229-
if ( ret && ret.specified ) {
230-
return ret.value;
231-
}
232-
},
233-
set: nodeHook.set
234-
};
235-
236-
// Set contenteditable to false on removals(#10429)
237-
// Setting to empty string throws an error as an invalid value
238-
jQuery.attrHooks.contenteditable = {
239-
set: function( elem, value, name ) {
240-
nodeHook.set( elem, value === "" ? false : value, name );
241178
}
242179
};
243-
244-
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
245-
// This is for removals
246-
jQuery.each([ "width", "height" ], function( i, name ) {
247-
jQuery.attrHooks[ name ] = {
248-
set: function( elem, value ) {
249-
if ( value === "" ) {
250-
elem.setAttribute( name, "auto" );
251-
return value;
252-
}
253-
}
254-
};
255-
});
256180
}
257181

258182
if ( !support.style ) {

src/attributes/prop.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,6 @@ jQuery.extend({
8080
}
8181
});
8282

83-
// Some attributes require a special call on IE
84-
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
85-
if ( !support.hrefNormalized ) {
86-
// href/src property should get the full normalized URL (#10299/#12915)
87-
jQuery.each([ "href", "src" ], function( i, name ) {
88-
jQuery.propHooks[ name ] = {
89-
get: function( elem ) {
90-
return elem.getAttribute( name, 4 );
91-
}
92-
};
93-
});
94-
}
95-
96-
// Support: Safari, IE9+
97-
// mis-reports the default selected property of an option
98-
// Accessing the parent's selectedIndex property fixes it
9983
if ( !support.optSelected ) {
10084
jQuery.propHooks.selected = {
10185
get: function( elem ) {
@@ -129,9 +113,4 @@ jQuery.each([
129113
jQuery.propFix[ this.toLowerCase() ] = this;
130114
});
131115

132-
// IE6/7 call enctype encoding
133-
if ( !support.enctype ) {
134-
jQuery.propFix.enctype = "encoding";
135-
}
136-
137116
});

0 commit comments

Comments
 (0)