🌐 AI搜索 & 代理 主页
Skip to content

Commit b3e684a

Browse files
committed
Core: Drop support for IE (all versions)
1 parent 09972bc commit b3e684a

Some content is hidden

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

56 files changed

+192
-803
lines changed

Gruntfile.cjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ module.exports = function( grunt ) {
184184
"firefox-debug": {
185185
browsers: [ "Firefox" ],
186186
singleRun: false
187-
},
188-
"ie-debug": {
189-
browsers: [ "IE" ],
190-
singleRun: false
191187
}
192188
}
193189
} );

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"karma-browserstack-launcher": "1.6.0",
110110
"karma-chrome-launcher": "3.1.1",
111111
"karma-firefox-launcher": "2.1.2",
112-
"karma-ie-launcher": "1.0.0",
113112
"karma-jsdom-launcher": "12.0.0",
114113
"karma-qunit": "4.1.2",
115114
"karma-webkit-launcher": "2.1.0",

src/ajax.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -455,20 +455,12 @@ jQuery.extend( {
455455
if ( !responseHeaders ) {
456456
responseHeaders = {};
457457
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
458-
459-
// Support: IE 11+
460-
// `getResponseHeader( key )` in IE doesn't combine all header
461-
// values for the provided key into a single result with values
462-
// joined by commas as other browsers do. Instead, it returns
463-
// them on separate lines.
464-
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
465-
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
466-
.concat( match[ 2 ] );
458+
responseHeaders[ match[ 1 ].toLowerCase() + " " ] = match[ 2 ];
467459
}
468460
}
469461
match = responseHeaders[ key.toLowerCase() + " " ];
470462
}
471-
return match == null ? null : match.join( ", " );
463+
return match == null ? null : match;
472464
},
473465

474466
// Raw string
@@ -542,24 +534,8 @@ jQuery.extend( {
542534
// A cross-domain request is in order when the origin doesn't match the current origin.
543535
if ( s.crossDomain == null ) {
544536
urlAnchor = document.createElement( "a" );
545-
546-
// Support: IE <=8 - 11+
547-
// IE throws exception on accessing the href property if url is malformed,
548-
// e.g. http://example.com:80x/
549-
try {
550-
urlAnchor.href = s.url;
551-
552-
// Support: IE <=8 - 11+
553-
// Anchor's host property isn't correctly set when s.url is relative
554-
urlAnchor.href = urlAnchor.href;
555-
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
556-
urlAnchor.protocol + "//" + urlAnchor.host;
557-
} catch ( e ) {
558-
559-
// If there is an error parsing the URL, assume it is crossDomain,
560-
// it can be rejected by the transport if it is invalid
561-
s.crossDomain = true;
562-
}
537+
urlAnchor.href = s.url;
538+
s.crossDomain = originAnchor.origin !== urlAnchor.origin;
563539
}
564540

565541
// Apply prefilters

src/ajax/load.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jQuery.fn.load = function( url, params, callback ) {
5050

5151
self.html( selector ?
5252

53-
// If a selector was specified, locate the right elements in a dummy div
54-
// Exclude scripts to avoid IE 'Permission Denied' errors
53+
// If a selector was specified, locate the right elements in a dummy div.
54+
// Exclude scripts.
5555
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
5656

5757
// Otherwise use the full result

src/attributes/attr.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { jQuery } from "../core.js";
22
import { access } from "../core/access.js";
3-
import { nodeName } from "../core/nodeName.js";
43
import { rnothtmlwhite } from "../var/rnothtmlwhite.js";
5-
import { isIE } from "../var/isIE.js";
64

75
import "../selector.js";
86

@@ -82,23 +80,6 @@ jQuery.extend( {
8280
}
8381
} );
8482

85-
// Support: IE <=11+
86-
// An input loses its value after becoming a radio
87-
if ( isIE ) {
88-
jQuery.attrHooks.type = {
89-
set: function( elem, value ) {
90-
if ( value === "radio" && nodeName( elem, "input" ) ) {
91-
var val = elem.value;
92-
elem.setAttribute( "type", value );
93-
if ( val ) {
94-
elem.value = val;
95-
}
96-
return value;
97-
}
98-
}
99-
};
100-
}
101-
10283
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
10384
jQuery.attrHooks[ name ] = {
10485
get: function( elem ) {

src/attributes/prop.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { jQuery } from "../core.js";
22
import { access } from "../core/access.js";
3-
import { isIE } from "../var/isIE.js";
43

54
import "../selector.js";
65

@@ -56,7 +55,6 @@ jQuery.extend( {
5655
tabIndex: {
5756
get: function( elem ) {
5857

59-
// Support: IE <=9 - 11+
6058
// elem.tabIndex doesn't always return the
6159
// correct value when it hasn't been explicitly set
6260
// Use proper attribute retrieval (trac-12072)
@@ -87,39 +85,6 @@ jQuery.extend( {
8785
}
8886
} );
8987

90-
// Support: IE <=11+
91-
// Accessing the selectedIndex property forces the browser to respect
92-
// setting selected on the option. The getter ensures a default option
93-
// is selected when in an optgroup. ESLint rule "no-unused-expressions"
94-
// is disabled for this code since it considers such accessions noop.
95-
if ( isIE ) {
96-
jQuery.propHooks.selected = {
97-
get: function( elem ) {
98-
99-
var parent = elem.parentNode;
100-
if ( parent && parent.parentNode ) {
101-
// eslint-disable-next-line no-unused-expressions
102-
parent.parentNode.selectedIndex;
103-
}
104-
return null;
105-
},
106-
set: function( elem ) {
107-
108-
109-
var parent = elem.parentNode;
110-
if ( parent ) {
111-
// eslint-disable-next-line no-unused-expressions
112-
parent.selectedIndex;
113-
114-
if ( parent.parentNode ) {
115-
// eslint-disable-next-line no-unused-expressions
116-
parent.parentNode.selectedIndex;
117-
}
118-
}
119-
}
120-
};
121-
}
122-
12388
jQuery.each( [
12489
"tabIndex",
12590
"readOnly",

src/attributes/val.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { jQuery } from "../core.js";
2-
import { isIE } from "../var/isIE.js";
3-
import { stripAndCollapse } from "../core/stripAndCollapse.js";
42
import { nodeName } from "../core/nodeName.js";
53

64
import "../core/init.js";
@@ -140,23 +138,6 @@ jQuery.extend( {
140138
}
141139
} );
142140

143-
if ( isIE ) {
144-
jQuery.valHooks.option = {
145-
get: function( elem ) {
146-
147-
var val = elem.getAttribute( "value" );
148-
return val != null ?
149-
val :
150-
151-
// Support: IE <=10 - 11+
152-
// option.text throws exceptions (trac-14686, trac-14858)
153-
// Strip and collapse whitespace
154-
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
155-
stripAndCollapse( jQuery.text( elem ) );
156-
}
157-
};
158-
}
159-
160141
// Radios and checkboxes getter/setter
161142
jQuery.each( [ "radio", "checkbox" ], function() {
162143
jQuery.valHooks[ this ] = {

src/core.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,7 @@ jQuery.extend( {
323323
contains: function( a, b ) {
324324
var bup = b && b.parentNode;
325325

326-
return a === bup || !!( bup && bup.nodeType === 1 && (
327-
328-
// Support: IE 9 - 11+
329-
// IE doesn't have `contains` on SVG.
330-
a.contains ?
331-
a.contains( bup ) :
332-
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
333-
) );
326+
return a === bup || !!( bup && bup.nodeType === 1 && a.contains( bup ) );
334327
},
335328

336329
merge: function( first, second ) {
@@ -395,7 +388,7 @@ jQuery.extend( {
395388
}
396389

397390
// Flatten any nested arrays
398-
return flat( ret );
391+
return flat.call( ret );
399392
},
400393

401394
// A global GUID counter for objects

src/core/isAttached.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
import { jQuery } from "../core.js";
2-
import { documentElement } from "../var/documentElement.js";
32

4-
var isAttached = function( elem ) {
5-
return jQuery.contains( elem.ownerDocument, elem ) ||
6-
elem.getRootNode( composed ) === elem.ownerDocument;
7-
},
8-
composed = { composed: true };
3+
var composed = { composed: true };
94

10-
// Support: IE 9 - 11+
11-
// Check attachment across shadow DOM boundaries when possible (gh-3504).
12-
// Provide a fallback for browsers without Shadow DOM v1 support.
13-
if ( !documentElement.getRootNode ) {
14-
isAttached = function( elem ) {
15-
return jQuery.contains( elem.ownerDocument, elem );
16-
};
5+
export function isAttached( elem ) {
6+
return jQuery.contains( elem.ownerDocument, elem ) ||
7+
elem.getRootNode( composed ) === elem.ownerDocument;
178
}
18-
19-
export { isAttached };

src/core/parseXML.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ jQuery.parseXML = function( data ) {
77
return null;
88
}
99

10-
// Support: IE 9 - 11+
11-
// IE throws on parseFromString with invalid input.
12-
try {
13-
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
14-
} catch ( e ) {}
10+
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
1511

16-
parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
17-
if ( !xml || parserErrorElem ) {
18-
jQuery.error( "Invalid XML: " + (
19-
parserErrorElem ?
20-
jQuery.map( parserErrorElem.childNodes, function( el ) {
21-
return el.textContent;
22-
} ).join( "\n" ) :
23-
data
24-
) );
12+
parserErrorElem = xml.getElementsByTagName( "parsererror" )[ 0 ];
13+
if ( parserErrorElem ) {
14+
jQuery.error( "Invalid XML: " +
15+
jQuery.map( parserErrorElem.childNodes, function( el ) {
16+
return el.textContent;
17+
} ).join( "\n" )
18+
);
2519
}
2620
return xml;
2721
};

0 commit comments

Comments
 (0)