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

Commit e35fb62

Browse files
authored
Core: Drop support for Edge Legacy (i.e. non-Chromium Microsoft Edge)
Drop support for Edge Legacy: the non-Chromium, EdgeHTML-based Microsoft Edge version. Also, restrict some workarounds that were applied unconditionally in all browsers to run only in IE now. This slightly increases the size but reduces the performance burden on modern browsers that don't need the workarounds. Also, clean up some comments & remove some obsolete workarounds. Fixes gh-4568 Closes gh-4792
1 parent 15ae361 commit e35fb62

24 files changed

+105
-244
lines changed

src/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ jQuery.extend( {
543543
if ( s.crossDomain == null ) {
544544
urlAnchor = document.createElement( "a" );
545545

546-
// Support: IE <=8 - 11+, Edge 12 - 17 only
546+
// Support: IE <=8 - 11+
547547
// IE throws exception on accessing the href property if url is malformed,
548548
// e.g. http://example.com:80x/
549549
try {

src/attributes/prop.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ jQuery.extend( {
6969

7070
if (
7171
rfocusable.test( elem.nodeName ) ||
72-
rclickable.test( elem.nodeName ) &&
73-
elem.href
72+
73+
// href-less anchor's `tabIndex` property value is `0` and
74+
// the `tabindex` attribute value: `null`. We want `-1`.
75+
rclickable.test( elem.nodeName ) && elem.href
7476
) {
7577
return 0;
7678
}

src/core.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,7 @@ jQuery.extend( {
273273
ret += jQuery.text( node );
274274
}
275275
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
276-
277-
// Use textContent for elements
278-
// innerText usage removed for consistency of new lines (jQuery #11153)
279-
if ( typeof elem.textContent === "string" ) {
280-
return elem.textContent;
281-
} else {
282-
283-
// Traverse its children
284-
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
285-
ret += jQuery.text( elem );
286-
}
287-
}
276+
return elem.textContent;
288277
} else if ( nodeType === 3 || nodeType === 4 ) {
289278
return elem.nodeValue;
290279
}

src/core/DOMEval.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,14 @@ var preservedScriptAttributes = {
1010
function DOMEval( code, node, doc ) {
1111
doc = doc || document;
1212

13-
var i, val,
13+
var i,
1414
script = doc.createElement( "script" );
1515

1616
script.text = code;
1717
if ( node ) {
1818
for ( i in preservedScriptAttributes ) {
19-
20-
// Support: Firefox <=64 - 66+, Edge <=18+
21-
// Some browsers don't support the "nonce" property on scripts.
22-
// On the other hand, just using `getAttribute` is not enough as
23-
// the `nonce` attribute is reset to an empty string whenever it
24-
// becomes browsing-context connected.
25-
// See https://github.com/whatwg/html/issues/2369
26-
// See https://html.spec.whatwg.org/#nonce-attributes
27-
// The `node.getAttribute` check was added for the sake of
28-
// `jQuery.globalEval` so that it can fake a nonce-containing node
29-
// via an object.
30-
val = node[ i ] || node.getAttribute && node.getAttribute( i );
31-
if ( val ) {
32-
script.setAttribute( i, val );
19+
if ( node[ i ] ) {
20+
script[ i ] = node[ i ];
3321
}
3422
}
3523
}

src/core/isAttached.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import documentElement from "../var/documentElement.js";
44
import "../selector/contains.js"; // jQuery.contains
55

66
var isAttached = function( elem ) {
7-
return jQuery.contains( elem.ownerDocument, elem );
7+
return jQuery.contains( elem.ownerDocument, elem ) ||
8+
elem.getRootNode( composed ) === elem.ownerDocument;
89
},
910
composed = { composed: true };
1011

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

src/css.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import getStyles from "./css/var/getStyles.js";
1111
import swap from "./css/var/swap.js";
1212
import curCSS from "./css/curCSS.js";
1313
import adjustCSS from "./css/adjustCSS.js";
14-
import support from "./css/support.js";
1514
import finalPropName from "./css/finalPropName.js";
1615

1716
import "./core/init.js";
@@ -135,15 +134,19 @@ function getWidthOrHeight( elem, dimension, extra ) {
135134
}
136135

137136

138-
// Support: IE 9 - 11+
139-
// Use offsetWidth/offsetHeight for when box sizing is unreliable.
140-
// In those cases, the computed value can be trusted to be border-box.
141-
if ( ( isIE && isBorderBox ||
137+
if ( ( isIE &&
138+
(
142139

143-
// Support: IE 10 - 11+, Edge 15 - 18+
144-
// IE/Edge misreport `getComputedStyle` of table rows with width/height
145-
// set in CSS while `offset*` properties report correct values.
146-
!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
140+
// Support: IE 9 - 11+
141+
// Use offsetWidth/offsetHeight for when box sizing is unreliable.
142+
// In those cases, the computed value can be trusted to be border-box.
143+
isBorderBox ||
144+
145+
// Support: IE 10 - 11+
146+
// IE misreports `getComputedStyle` of table rows with width/height
147+
// set in CSS while `offset*` properties report correct values.
148+
nodeName( elem, "tr" )
149+
) ||
147150

148151
// Fall back to offsetWidth/offsetHeight when value is "auto"
149152
// This happens for inline elements with no explicit setting (gh-3571)

src/css/cssCamelCase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var rmsPrefix = /^-ms-/;
55

66
// Convert dashed to camelCase, handle vendor prefixes.
77
// Used by the css & effects modules.
8-
// Support: IE <=9 - 11+, Edge 12 - 18+
8+
// Support: IE <=9 - 11+
99
// Microsoft forgot to hump their vendor prefix (#9572)
1010
function cssCamelCase( string ) {
1111
return camelCase( string.replace( rmsPrefix, "ms-" ) );

src/css/support.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/effects.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ function defaultPrefilter( elem, props, opts ) {
143143
// Restrict "overflow" and "display" styles during box animations
144144
if ( isBox && elem.nodeType === 1 ) {
145145

146-
// Support: IE <=9 - 11+, Edge 12 - 18+
146+
// Support: IE <=9 - 11+
147147
// Record all 3 overflow attributes because IE does not infer the shorthand
148-
// from identically-valued overflowX and overflowY and Edge just mirrors
149-
// the overflowX value there.
148+
// from identically-valued overflowX and overflowY.
150149
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
151150

152151
// Identify a display type, preferring old show/hide data over the CSS cascade

src/manipulation.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import "./event.js";
2323

2424
var
2525

26-
// Support: IE <=10 - 11+, Edge 12 - 13 only
27-
// In IE/Edge using regex groups here causes severe slowdowns.
28-
// See https://connect.microsoft.com/IE/feedback/details/1736512/
26+
// Support: IE <=10 - 11+
27+
// In IE using regex groups here causes severe slowdowns.
2928
rnoInnerhtml = /<script|<style|<link/i,
3029

3130
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
@@ -157,7 +156,7 @@ function domManip( collection, args, callback, ignored ) {
157156
// Optional AJAX dependency, but won't run scripts if not present
158157
if ( jQuery._evalUrl && !node.noModule ) {
159158
jQuery._evalUrl( node.src, {
160-
nonce: node.nonce || node.getAttribute( "nonce" ),
159+
nonce: node.nonce,
161160
crossOrigin: node.crossOrigin
162161
}, doc );
163162
}

0 commit comments

Comments
 (0)