diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2020-09-22 17:49:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 17:49:28 +0200 |
commit | e35fb62db4fb46f031056bb53e393982c03972a1 (patch) | |
tree | ae55e7e05133da5637d188d73c312c4538d8b5b4 /src | |
parent | 15ae361485056b236a9484a185238f992806e1ff (diff) | |
download | jquery-e35fb62db4fb46f031056bb53e393982c03972a1.tar.gz jquery-e35fb62db4fb46f031056bb53e393982c03972a1.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax.js | 2 | ||||
-rw-r--r-- | src/attributes/prop.js | 6 | ||||
-rw-r--r-- | src/core.js | 13 | ||||
-rw-r--r-- | src/core/DOMEval.js | 18 | ||||
-rw-r--r-- | src/core/isAttached.js | 13 | ||||
-rw-r--r-- | src/css.js | 21 | ||||
-rw-r--r-- | src/css/cssCamelCase.js | 2 | ||||
-rw-r--r-- | src/css/support.js | 34 | ||||
-rw-r--r-- | src/effects.js | 5 | ||||
-rw-r--r-- | src/manipulation.js | 7 | ||||
-rw-r--r-- | src/selector.js | 37 | ||||
-rw-r--r-- | src/selector/rbuggyQSA.js | 32 | ||||
-rw-r--r-- | src/selector/support.js | 11 | ||||
-rw-r--r-- | src/selector/uniqueSort.js | 12 | ||||
-rw-r--r-- | src/var/flat.js | 4 |
15 files changed, 70 insertions, 147 deletions
diff --git a/src/ajax.js b/src/ajax.js index 55b528eac..3921de6b5 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -543,7 +543,7 @@ jQuery.extend( { if ( s.crossDomain == null ) { urlAnchor = document.createElement( "a" ); - // Support: IE <=8 - 11+, Edge 12 - 17 only + // Support: IE <=8 - 11+ // IE throws exception on accessing the href property if url is malformed, // e.g. http://example.com:80x/ try { diff --git a/src/attributes/prop.js b/src/attributes/prop.js index d58adf369..453d4c7cd 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -69,8 +69,10 @@ jQuery.extend( { if ( rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href + + // href-less anchor's `tabIndex` property value is `0` and + // the `tabindex` attribute value: `null`. We want `-1`. + rclickable.test( elem.nodeName ) && elem.href ) { return 0; } diff --git a/src/core.js b/src/core.js index ccc5389c5..e122305ce 100644 --- a/src/core.js +++ b/src/core.js @@ -273,18 +273,7 @@ jQuery.extend( { ret += jQuery.text( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += jQuery.text( elem ); - } - } + return elem.textContent; } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js index b0238fd69..059464188 100644 --- a/src/core/DOMEval.js +++ b/src/core/DOMEval.js @@ -10,26 +10,14 @@ var preservedScriptAttributes = { function DOMEval( code, node, doc ) { doc = doc || document; - var i, val, + var i, script = doc.createElement( "script" ); script.text = code; if ( node ) { for ( i in preservedScriptAttributes ) { - - // Support: Firefox <=64 - 66+, Edge <=18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); + if ( node[ i ] ) { + script[ i ] = node[ i ]; } } } diff --git a/src/core/isAttached.js b/src/core/isAttached.js index 3857d94a8..9c57a4741 100644 --- a/src/core/isAttached.js +++ b/src/core/isAttached.js @@ -4,16 +4,17 @@ import documentElement from "../var/documentElement.js"; import "../selector/contains.js"; // jQuery.contains var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; }, composed = { composed: true }; -// Support: IE 9 - 11+, Edge 12 - 18+ -// Check attachment across shadow DOM boundaries when possible (gh-3504) -if ( documentElement.getRootNode ) { +// Support: IE 9 - 11+ +// Check attachment across shadow DOM boundaries when possible (gh-3504). +// Provide a fallback for browsers without Shadow DOM v1 support. +if ( !documentElement.getRootNode ) { isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; + return jQuery.contains( elem.ownerDocument, elem ); }; } diff --git a/src/css.js b/src/css.js index 8c4070c71..126d12a17 100644 --- a/src/css.js +++ b/src/css.js @@ -11,7 +11,6 @@ import getStyles from "./css/var/getStyles.js"; import swap from "./css/var/swap.js"; import curCSS from "./css/curCSS.js"; import adjustCSS from "./css/adjustCSS.js"; -import support from "./css/support.js"; import finalPropName from "./css/finalPropName.js"; import "./core/init.js"; @@ -135,15 +134,19 @@ function getWidthOrHeight( elem, dimension, extra ) { } - // Support: IE 9 - 11+ - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( isIE && isBorderBox || + if ( ( isIE && + ( - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || + // Support: IE 9 - 11+ + // Use offsetWidth/offsetHeight for when box sizing is unreliable. + // In those cases, the computed value can be trusted to be border-box. + isBorderBox || + + // Support: IE 10 - 11+ + // IE misreports `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + nodeName( elem, "tr" ) + ) || // Fall back to offsetWidth/offsetHeight when value is "auto" // This happens for inline elements with no explicit setting (gh-3571) diff --git a/src/css/cssCamelCase.js b/src/css/cssCamelCase.js index 895303248..a3d5fe628 100644 --- a/src/css/cssCamelCase.js +++ b/src/css/cssCamelCase.js @@ -5,7 +5,7 @@ var rmsPrefix = /^-ms-/; // Convert dashed to camelCase, handle vendor prefixes. // Used by the css & effects modules. -// Support: IE <=9 - 11+, Edge 12 - 18+ +// Support: IE <=9 - 11+ // Microsoft forgot to hump their vendor prefix (#9572) function cssCamelCase( string ) { return camelCase( string.replace( rmsPrefix, "ms-" ) ); diff --git a/src/css/support.js b/src/css/support.js deleted file mode 100644 index dc18708c1..000000000 --- a/src/css/support.js +++ /dev/null @@ -1,34 +0,0 @@ -import document from "../var/document.js"; -import documentElement from "../var/documentElement.js"; -import support from "../var/support.js"; - -var reliableTrDimensionsVal; - -// Support: IE 11+, Edge 15 - 18+ -// IE/Edge misreport `getComputedStyle` of table rows with width/height -// set in CSS while `offset*` properties report correct values. -support.reliableTrDimensions = function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px"; - tr.style.height = "1px"; - trChild.style.height = "9px"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; -}; - -export default support; diff --git a/src/effects.js b/src/effects.js index f94da06a9..50b1a6ef0 100644 --- a/src/effects.js +++ b/src/effects.js @@ -143,10 +143,9 @@ function defaultPrefilter( elem, props, opts ) { // Restrict "overflow" and "display" styles during box animations if ( isBox && elem.nodeType === 1 ) { - // Support: IE <=9 - 11+, Edge 12 - 18+ + // Support: IE <=9 - 11+ // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. + // from identically-valued overflowX and overflowY. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Identify a display type, preferring old show/hide data over the CSS cascade diff --git a/src/manipulation.js b/src/manipulation.js index 7838e2293..f86bd9ab0 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -23,9 +23,8 @@ import "./event.js"; var - // Support: IE <=10 - 11+, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ + // Support: IE <=10 - 11+ + // In IE using regex groups here causes severe slowdowns. rnoInnerhtml = /<script|<style|<link/i, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; @@ -157,7 +156,7 @@ function domManip( collection, args, callback, ignored ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl && !node.noModule ) { jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ), + nonce: node.nonce, crossOrigin: node.crossOrigin }, doc ); } diff --git a/src/selector.js b/src/selector.js index 0d80c6fd3..f7e8d9b60 100644 --- a/src/selector.js +++ b/src/selector.js @@ -7,7 +7,7 @@ import pop from "./var/pop.js"; import push from "./var/push.js"; import whitespace from "./selector/var/whitespace.js"; import rbuggyQSA from "./selector/rbuggyQSA.js"; -import support from "./selector/support.js"; +import isIE from "./var/isIE.js"; // The following utils are attached directly to the jQuery object. import "./selector/contains.js"; @@ -131,9 +131,9 @@ var i, }, // Used for iframes; see `setDocument`. - // Support: IE 9 - 11+, Edge 12 - 18+ + // Support: IE 9 - 11+ // Removing the function wrapper causes a "Permission Denied" - // error in IE/Edge. + // error in IE. unloadHandler = function() { setDocument(); }, @@ -229,9 +229,9 @@ function find( selector, context, results, seed ) { newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { + // Outside of IE, if we're not changing the context we can + // use :scope instead of an ID. + if ( newContext !== context || isIE ) { // Capture the context ID, setting it first if necessary if ( ( nid = context.getAttribute( "id" ) ) ) { @@ -360,7 +360,6 @@ function createDisabledPseudo( disabled ) { return elem.isDisabled === disabled || // Where there is no isDisabled, check manually - /* jshint -W018 */ elem.isDisabled !== !disabled && inDisabledFieldset( elem ) === disabled; } @@ -419,8 +418,8 @@ function setDocument( node ) { doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq if ( doc == document || doc.nodeType !== 9 ) { @@ -432,16 +431,14 @@ function setDocument( node ) { documentElement = document.documentElement; documentIsHTML = !jQuery.isXMLDoc( document ); - // Support: IE 9 - 11+, Edge 12 - 18+ + // Support: IE 9 - 11+ // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && + if ( isIE && preferredDoc != document && ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 9 - 11+, Edge 12 - 18+ subWindow.addEventListener( "unload", unloadHandler ); } } @@ -928,7 +925,7 @@ Expr = jQuery.expr = { // Accessing the selectedIndex property // forces the browser to treat the default option as // selected when in an optgroup. - if ( elem.parentNode ) { + if ( isIE && elem.parentNode ) { // eslint-disable-next-line no-unused-expressions elem.parentNode.selectedIndex; } @@ -1412,8 +1409,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { if ( outermost ) { - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq outermostContext = context == document || context || outermost; @@ -1424,8 +1421,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { if ( byElement && elem ) { j = 0; - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq if ( !context && elem.ownerDocument != document ) { diff --git a/src/selector/rbuggyQSA.js b/src/selector/rbuggyQSA.js index e9ebbb34e..7a6210733 100644 --- a/src/selector/rbuggyQSA.js +++ b/src/selector/rbuggyQSA.js @@ -1,29 +1,19 @@ -import document from "../var/document.js"; import isIE from "../var/isIE.js"; import whitespace from "./var/whitespace.js"; -var rbuggyQSA = [], - testEl = document.createElement( "div" ), - input = document.createElement( "input" ); +var rbuggyQSA = isIE && new RegExp( -// Support: IE 9 - 11+ -// IE's :disabled selector does not pick up the children of disabled fieldsets -if ( isIE ) { - rbuggyQSA.push( ":enabled", ":disabled" ); -} + // Support: IE 9 - 11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + ":enabled|:disabled|" + -// Support: IE 11+, Edge 15 - 18+ -// IE 11/Edge don't find elements on a `[name='']` query in some cases. -// Adding a temporary attribute to the document before the selection works -// around the issue. -// Interestingly, IE 10 & older don't seem to have the issue. -input.setAttribute( "name", "" ); -testEl.appendChild( input ); -if ( !testEl.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); -} + // Support: IE 11+ + // IE 11 doesn't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" -rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); +); export default rbuggyQSA; diff --git a/src/selector/support.js b/src/selector/support.js deleted file mode 100644 index cc584bf66..000000000 --- a/src/selector/support.js +++ /dev/null @@ -1,11 +0,0 @@ -import document from "../var/document.js"; -import support from "../var/support.js"; - -// Support: IE 9 - 11+, Edge 12 - 18+ -// IE/Edge don't support the :scope pseudo-class. -try { - document.querySelectorAll( ":scope" ); - support.scope = true; -} catch ( e ) {} - -export default support; diff --git a/src/selector/uniqueSort.js b/src/selector/uniqueSort.js index d0bf69198..127cc7068 100644 --- a/src/selector/uniqueSort.js +++ b/src/selector/uniqueSort.js @@ -20,8 +20,8 @@ function sortOrder( a, b ) { } // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? @@ -34,8 +34,8 @@ function sortOrder( a, b ) { if ( compare & 1 ) { // Choose the first element that is related to the document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq if ( a == document || a.ownerDocument == document && @@ -43,8 +43,8 @@ function sortOrder( a, b ) { return -1; } - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // Support: IE 11+ + // IE sometimes throws a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq if ( b == document || b.ownerDocument == document && diff --git a/src/var/flat.js b/src/var/flat.js index 172420552..de911aeef 100644 --- a/src/var/flat.js +++ b/src/var/flat.js @@ -1,7 +1,7 @@ import arr from "./arr.js"; -// Support: IE 11+, Edge 18+ -// Provide fallback for browsers without Array#flat. +// Support: IE 11+ +// IE doesn't have Array#flat; provide a fallback. export default arr.flat ? function( array ) { return arr.flat.call( array ); } : function( array ) { |