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 | |
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
-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 | ||||
-rw-r--r-- | test/jquery.js | 4 | ||||
-rw-r--r-- | test/unit/ajax.js | 6 | ||||
-rw-r--r-- | test/unit/core.js | 8 | ||||
-rw-r--r-- | test/unit/css.js | 12 | ||||
-rw-r--r-- | test/unit/data.js | 16 | ||||
-rw-r--r-- | test/unit/effects.js | 6 | ||||
-rw-r--r-- | test/unit/manipulation.js | 29 | ||||
-rw-r--r-- | test/unit/selector.js | 16 | ||||
-rw-r--r-- | test/unit/support.js | 35 |
24 files changed, 105 insertions, 244 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 ) { diff --git a/test/jquery.js b/test/jquery.js index 2d12a5ff3..329285251 100644 --- a/test/jquery.js +++ b/test/jquery.js @@ -58,8 +58,8 @@ // This doesn't apply to iframes because they synchronously expect jQuery to be there. if ( config.esmodules && QUnit ) { - // Support: IE 11+, Edge 12 - 18+ - // IE/Edge don't support the dynamic import syntax so they'd crash + // Support: IE 11+ + // IE doesn't support the dynamic import syntax so it would crash // with a SyntaxError here. dynamicImportSource = "" + "import( `${ parentUrl }src/jquery.js` )\n" + diff --git a/test/unit/ajax.js b/test/unit/ajax.js index db0af6cec..b3b78cc5f 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -271,7 +271,7 @@ QUnit.module( "ajax", { "Nullable": null, "undefined": undefined - // Support: IE 9 - 11+, Edge 12 - 14 only + // Support: IE 9 - 11+ // IE can receive empty headers but not send them. }, QUnit.isIE ? {} : { "Empty": "" @@ -2281,9 +2281,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re // beforeunload, unload, pagehide, and visibilitychange event handlers. // See https://bugs.chromium.org/p/chromium/issues/detail?id=952452 // Safari 13 did similar changes. The below check will catch them both. - // Edge Legacy fakes Chrome which fakes Safari in their user agents so we need - // to exclude Edge specifically here so that the test continues to run there. - if ( !/safari/i.test( navigator.userAgent ) || /edge\//i.test( navigator.userAgent ) ) { + if ( !/safari/i.test( navigator.userAgent ) ) { testIframe( "#14379 - jQuery.ajax() on unload", "ajax/onunload.html", diff --git a/test/unit/core.js b/test/unit/core.js index d457e91fa..e24966551 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -801,15 +801,15 @@ QUnit.test( "jQuery.map", function( assert ) { assert.equal( result.length, 3, "Array flatten only one level down" ); assert.ok( Array.isArray( result[ 0 ] ), "Array flatten only one level down" ); - // Support: IE 11+, Edge 18+ - // Skip the test in browsers without Array#flat. - if ( Array.prototype.flat ) { + // Support: IE 11+ + // IE doesn't have Array#flat so it'd fail the test. + if ( !QUnit.isIE ) { result = jQuery.map( Array( 300000 ), function( v, k ) { return k; } ); assert.equal( result.length, 300000, "Able to map 300000 records without any problems (#4320)" ); } else { - assert.ok( "skip", "Array#flat doesn't supported on all browsers" ); + assert.ok( "skip", "Array#flat isn't supported in IE" ); } } ); diff --git a/test/unit/css.js b/test/unit/css.js index 095f3641b..6d2983f87 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -638,9 +638,9 @@ QUnit.test( "show/hide detached nodes", function( assert ) { span.remove(); } ); -// Support: IE 11+, Edge 12 - 18+ -// IE/Edge don't support Shadow DOM. -QUnit[ document.body.getRootNode ? "test" : "skip" ]( +// Support: IE 11+ +// IE doesn't support Shadow DOM. +QUnit.testUnlessIE( "show/hide shadow child nodes", function( assert ) { assert.expect( 28 ); @@ -1022,7 +1022,7 @@ QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle ? "test" : "skip" ]( "detached "cascade-hidden element in detached tree" ); } ); -QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle && document.body.getRootNode ? "test" : "skip" ]( +QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle && !QUnit.isIE ? "test" : "skip" ]( "shadow toggle()", function( assert ) { assert.expect( 4 ); @@ -1758,9 +1758,7 @@ QUnit.testUnlessIE( "css(--customProperty)", function( assert ) { var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ), $elem = jQuery( "<div>" ).addClass( "test__customProperties" ) .appendTo( "#qunit-fixture" ), - webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ) && - !/\bfirefox\b/i.test( navigator.userAgent ) && - !/\bedge\b/i.test( navigator.userAgent ), + webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ), expected = 10; if ( webkitOrBlink ) { diff --git a/test/unit/data.js b/test/unit/data.js index 60ee017d6..301bee917 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -629,10 +629,6 @@ QUnit.test( ".data always sets data with the camelCased key (gh-2257)", function key: "boolFalse", value: false }, - - // JSHint enforces double quotes, - // but JSON strings need double quotes to parse - // so we need escaped double quotes here "some-json": { key: "someJson", value: "{ \"foo\": \"bar\" }" @@ -693,10 +689,6 @@ QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of proper key: "boolFalse", value: false }, - - // JSHint enforces double quotes, - // but JSON strings need double quotes to parse - // so we need escaped double quotes here "some-json": { key: "someJson", value: "{ \"foo\": \"bar\" }" @@ -756,10 +748,6 @@ QUnit.test( ".data supports interoperable removal of hyphenated/camelCase proper "an-object": {}, "bool-true": true, "bool-false": false, - - // JSHint enforces double quotes, - // but JSON strings need double quotes to parse - // so we need escaped double quotes here "some-json": "{ \"foo\": \"bar\" }" }; @@ -797,10 +785,6 @@ QUnit.test( ".data supports interoperable removal of properties SET TWICE #13850 "an-object": {}, "bool-true": true, "bool-false": false, - - // JSHint enforces double quotes, - // but JSON strings need double quotes to parse - // so we need escaped double quotes here "some-json": "{ \"foo\": \"bar\" }" }; diff --git a/test/unit/effects.js b/test/unit/effects.js index 0acb393ce..2278b3afb 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -216,9 +216,9 @@ supportjQuery.each( hideOptions, function( type, setup ) { clock.tick( 300 ); } ); - // Support: IE 11+, Edge 12 - 18+ - // IE/Edge don't support Shadow DOM. - QUnit[ document.body.getRootNode ? "test" : "skip" ]( + // Support: IE 11+ + // IE doesn't support Shadow DOM. + QUnit.testUnlessIE( "Persist correct display value - " + type + " hidden, shadow child", function( assert ) { assert.expect( 3 ); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 9058c1649..131109448 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1762,13 +1762,9 @@ QUnit.test( "html(Function)", function( assert ) { testHtml( manipulationFunctionReturningObj, assert ); } ); -QUnit[ - // Support: Edge 16 - 18+ - // Edge sometimes doesn't execute module scripts so skip the test there. - ( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ? - "skip" : - "test" -]( "html(script type module)", function( assert ) { +// Support: IE 9 - 11+ +// IE doesn't support modules. +QUnit.testUnlessIE( "html(script type module)", function( assert ) { assert.expect( 4 ); var done = assert.async(), $fixture = jQuery( "#qunit-fixture" ); @@ -2897,12 +2893,7 @@ testIframe( assert.equal( data, "", "No log request should be sent" ); supportjQuery.get( baseURL + "mock.php?action=cspClean" ).done( done ); } ); - }, - - // Support: Edge <=18+ - // Edge doesn't support nonce in non-inline scripts. - // See https://web.archive.org/web/20171203124125/https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/ - QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ] + } ); testIframe( @@ -2920,10 +2911,7 @@ testIframe( }, // The AJAX module is needed for jQuery._evalUrl. - // Support: Edge <=18+ - // Edge doesn't support nonce in non-inline scripts. - // See https://web.archive.org/web/20171203124125/https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/ - QUnit[ jQuery.ajax && !/\bedge\//i.test( navigator.userAgent ) ? "test" : "skip" ] + QUnit[ jQuery.ajax ? "test" : "skip" ] ); testIframe( @@ -2938,12 +2926,7 @@ testIframe( assert.equal( data, "", "No log request should be sent" ); supportjQuery.get( baseURL + "mock.php?action=cspClean" ).done( done ); } ); - }, - - // Support: Edge <=18+ - // Edge doesn't support nonce in non-inline scripts. - // See https://web.archive.org/web/20171203124125/https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/ - QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ] + } ); QUnit.test( "Sanitized HTML doesn't get unsanitized", function( assert ) { diff --git a/test/unit/selector.js b/test/unit/selector.js index 1111e2460..b11b801c6 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -1661,14 +1661,10 @@ QUnit.test( "context", function( assert ) { } } ); -// Support: IE 11+, Edge 12 - 18+ -// IE/Edge don't support the :scope pseudo-class so they will trigger MutationObservers. +// Support: IE 11+ +// IE doesn't support the :scope pseudo-class so it will trigger MutationObservers. // The test is skipped there. -QUnit[ - ( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ? - "skip" : - "test" - ]( "selectors maintaining context don't trigger mutation observers", function( assert ) { +QUnit.testUnlessIE( "selectors maintaining context don't trigger mutation observers", function( assert ) { assert.expect( 1 ); var timeout, @@ -1742,10 +1738,10 @@ QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "disconnected nodes", function assert.equal( $opt.is( ":selected" ), true, "selected option" ); } ); -// Support: IE 11+, Edge 12 - 18+ -// IE/Edge don't support Shadow DOM. +// Support: IE 11+ +// IE doesn't support Shadow DOM. // selector-native doesn't support querying inside of Shadow DOM. -QUnit[ QUnit.jQuerySelectors && document.body.getRootNode ? "test" : "skip" ]( +QUnit[ QUnit.jQuerySelectors && !QUnit.isIE ? "test" : "skip" ]( "Shadow DOM nodes supported as root", function( assert ) { assert.expect( 2 ); diff --git a/test/unit/support.js b/test/unit/support.js index b2d4eb350..008453085 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -58,39 +58,18 @@ testIframe( var expected, userAgent = window.navigator.userAgent, expectedMap = { - edge: { - reliableTrDimensions: false, - scope: undefined - }, - ie_11: { - reliableTrDimensions: false, - scope: undefined - }, - chrome: { - reliableTrDimensions: true, - scope: true - }, - safari: { - reliableTrDimensions: true, - scope: true - }, - firefox: { - reliableTrDimensions: true, - scope: true - }, - ios: { - reliableTrDimensions: true, - scope: true - } + ie_11: {}, + chrome: {}, + safari: {}, + firefox: {}, + ios: {} }; - if ( /edge\//i.test( userAgent ) ) { - expected = expectedMap.edge; - } else if ( document.documentMode ) { + if ( document.documentMode ) { expected = expectedMap.ie_11; } else if ( /chrome/i.test( userAgent ) ) { - // Catches Chrome on Android & Opera as well. + // Catches Edge, Chrome on Android & Opera as well. expected = expectedMap.chrome; } else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) { expected = expectedMap.safari; |