Skip to content

Commit 2b742de

Browse files
committed
Core: Drop support for EdgeHTML (i.e. non-Chromium Microsoft Edge)
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 jquerygh-4568
1 parent df6858d commit 2b742de

24 files changed

+111
-250
lines changed

src/ajax.js

+1-1
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

+4-2
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 anchors `tabIndex` property value is `0` and the `tabindex`
74+
// attribute value: `null`. We want `-1`.
75+
rclickable.test( elem.nodeName ) && elem.href
7476
) {
7577
return 0;
7678
}

src/core.js

+1-12
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

+3-15
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

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import documentElement from "../var/documentElement.js";
33

44
import "../selector/contains.js"; // jQuery.contains
55

6-
var isAttached = function( elem ) {
7-
return jQuery.contains( elem.ownerDocument, elem );
8-
},
9-
composed = { composed: true };
6+
var composed = { composed: true },
107

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

2020
export default isAttached;

src/css.js

+12-9
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

+1-1
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

-34
This file was deleted.

src/effects.js

+2-3
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

+3-4
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
}, doc );
162161
}
163162
} else {

src/selector.js

+18-20
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import pop from "./var/pop.js";
77
import push from "./var/push.js";
88
import whitespace from "./selector/var/whitespace.js";
99
import rbuggyQSA from "./selector/rbuggyQSA.js";
10-
import support from "./selector/support.js";
10+
import isIE from "./var/isIE.js";
1111

1212
// The following utils are attached directly to the jQuery object.
1313
import "./selector/contains.js";
@@ -131,9 +131,9 @@ var i,
131131
},
132132

133133
// Used for iframes; see `setDocument`.
134-
// Support: IE 9 - 11+, Edge 12 - 18+
134+
// Support: IE 9 - 11+
135135
// Removing the function wrapper causes a "Permission Denied"
136-
// error in IE/Edge.
136+
// error in IE.
137137
unloadHandler = function() {
138138
setDocument();
139139
},
@@ -150,7 +150,7 @@ function selectorError( msg ) {
150150
}
151151

152152
function find( selector, context, results, seed ) {
153-
var m, i, elem, nid, match, groups, newSelector,
153+
var m, i, elem, nid, match, groups, newSelector, canUseScope,
154154
newContext = context && context.ownerDocument,
155155

156156
// nodeType defaults to 9, since context defaults to document
@@ -231,9 +231,10 @@ function find( selector, context, results, seed ) {
231231

232232
// We can use :scope instead of the ID hack if the browser
233233
// supports it & if we're not changing the context.
234-
if ( newContext !== context || !support.scope ) {
234+
canUseScope = newContext === context && !isIE;
235235

236-
// Capture the context ID, setting it first if necessary
236+
// Capture the context ID, setting it first if necessary
237+
if ( !canUseScope ) {
237238
if ( ( nid = context.getAttribute( "id" ) ) ) {
238239
nid = jQuery.escapeSelector( nid );
239240
} else {
@@ -360,7 +361,6 @@ function createDisabledPseudo( disabled ) {
360361
return elem.isDisabled === disabled ||
361362

362363
// Where there is no isDisabled, check manually
363-
/* jshint -W018 */
364364
elem.isDisabled !== !disabled &&
365365
inDisabledFieldset( elem ) === disabled;
366366
}
@@ -419,8 +419,8 @@ function setDocument( node ) {
419419
doc = node ? node.ownerDocument || node : preferredDoc;
420420

421421
// Return early if doc is invalid or already selected
422-
// Support: IE 11+, Edge 17 - 18+
423-
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
422+
// Support: IE 11+
423+
// IE sometimes throws a "Permission denied" error when strict-comparing
424424
// two documents; shallow comparisons work.
425425
// eslint-disable-next-line eqeqeq
426426
if ( doc == document || doc.nodeType !== 9 ) {
@@ -432,16 +432,14 @@ function setDocument( node ) {
432432
documentElement = document.documentElement;
433433
documentIsHTML = !jQuery.isXMLDoc( document );
434434

435-
// Support: IE 9 - 11+, Edge 12 - 18+
435+
// Support: IE 9 - 11+
436436
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
437-
// Support: IE 11+, Edge 17 - 18+
438-
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
437+
// Support: IE 11+
438+
// IE sometimes throws a "Permission denied" error when strict-comparing
439439
// two documents; shallow comparisons work.
440440
// eslint-disable-next-line eqeqeq
441-
if ( preferredDoc != document &&
441+
if ( isIE && preferredDoc != document &&
442442
( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
443-
444-
// Support: IE 9 - 11+, Edge 12 - 18+
445443
subWindow.addEventListener( "unload", unloadHandler );
446444
}
447445
}
@@ -928,7 +926,7 @@ Expr = jQuery.expr = {
928926
// Accessing the selectedIndex property
929927
// forces the browser to treat the default option as
930928
// selected when in an optgroup.
931-
if ( elem.parentNode ) {
929+
if ( isIE && elem.parentNode ) {
932930
// eslint-disable-next-line no-unused-expressions
933931
elem.parentNode.selectedIndex;
934932
}
@@ -1412,8 +1410,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
14121410

14131411
if ( outermost ) {
14141412

1415-
// Support: IE 11+, Edge 17 - 18+
1416-
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1413+
// Support: IE 11+
1414+
// IE sometimes throws a "Permission denied" error when strict-comparing
14171415
// two documents; shallow comparisons work.
14181416
// eslint-disable-next-line eqeqeq
14191417
outermostContext = context == document || context || outermost;
@@ -1424,8 +1422,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
14241422
if ( byElement && elem ) {
14251423
j = 0;
14261424

1427-
// Support: IE 11+, Edge 17 - 18+
1428-
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1425+
// Support: IE 11+
1426+
// IE sometimes throws a "Permission denied" error when strict-comparing
14291427
// two documents; shallow comparisons work.
14301428
// eslint-disable-next-line eqeqeq
14311429
if ( !context && elem.ownerDocument != document ) {

src/selector/rbuggyQSA.js

+11-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
1-
import document from "../var/document.js";
21
import isIE from "../var/isIE.js";
32
import whitespace from "./var/whitespace.js";
43

5-
var rbuggyQSA = [],
6-
testEl = document.createElement( "div" ),
7-
input = document.createElement( "input" );
4+
var rbuggyQSA = isIE && new RegExp(
85

9-
// Support: IE 9 - 11+
10-
// IE's :disabled selector does not pick up the children of disabled fieldsets
11-
if ( isIE ) {
12-
rbuggyQSA.push( ":enabled", ":disabled" );
13-
}
6+
// Support: IE 9 - 11+
7+
// IE's :disabled selector does not pick up the children of disabled fieldsets
8+
":enabled|:disabled|" +
149

15-
// Support: IE 11+, Edge 15 - 18+
16-
// IE 11/Edge don't find elements on a `[name='']` query in some cases.
17-
// Adding a temporary attribute to the document before the selection works
18-
// around the issue.
19-
// Interestingly, IE 10 & older don't seem to have the issue.
20-
input.setAttribute( "name", "" );
21-
testEl.appendChild( input );
22-
if ( !testEl.querySelectorAll( "[name='']" ).length ) {
23-
rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
24-
whitespace + "*(?:''|\"\")" );
25-
}
10+
// Support: IE 11+
11+
// IE 11 doesn't find elements on a `[name='']` query in some cases.
12+
// Adding a temporary attribute to the document before the selection works
13+
// around the issue.
14+
"\\[" + whitespace + "*name" + whitespace + "*=" +
15+
whitespace + "*(?:''|\"\")"
2616

27-
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
17+
);
2818

2919
export default rbuggyQSA;

src/selector/support.js

-11
This file was deleted.

0 commit comments

Comments
 (0)