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
This commit is contained in:
Michał Gołębiowski-Owczarek 2020-09-22 17:49:28 +02:00 committed by GitHub
parent 15ae361485
commit e35fb62db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 105 additions and 244 deletions

View File

@ -543,7 +543,7 @@ jQuery.extend( {
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" ); 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, // IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/ // e.g. http://example.com:80x/
try { try {

View File

@ -69,8 +69,10 @@ jQuery.extend( {
if ( if (
rfocusable.test( elem.nodeName ) || 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; return 0;
} }

View File

@ -273,18 +273,7 @@ jQuery.extend( {
ret += jQuery.text( node ); ret += jQuery.text( node );
} }
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
return elem.textContent;
// 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 );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) { } else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue; return elem.nodeValue;
} }

View File

@ -10,26 +10,14 @@ var preservedScriptAttributes = {
function DOMEval( code, node, doc ) { function DOMEval( code, node, doc ) {
doc = doc || document; doc = doc || document;
var i, val, var i,
script = doc.createElement( "script" ); script = doc.createElement( "script" );
script.text = code; script.text = code;
if ( node ) { if ( node ) {
for ( i in preservedScriptAttributes ) { for ( i in preservedScriptAttributes ) {
if ( node[ i ] ) {
// Support: Firefox <=64 - 66+, Edge <=18+ script[ i ] = node[ i ];
// 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 );
} }
} }
} }

View File

@ -4,16 +4,17 @@ import documentElement from "../var/documentElement.js";
import "../selector/contains.js"; // jQuery.contains import "../selector/contains.js"; // jQuery.contains
var isAttached = function( elem ) { var isAttached = function( elem ) {
return jQuery.contains( elem.ownerDocument, elem ); return jQuery.contains( elem.ownerDocument, elem ) ||
elem.getRootNode( composed ) === elem.ownerDocument;
}, },
composed = { composed: true }; composed = { composed: true };
// Support: IE 9 - 11+, Edge 12 - 18+ // Support: IE 9 - 11+
// Check attachment across shadow DOM boundaries when possible (gh-3504) // Check attachment across shadow DOM boundaries when possible (gh-3504).
if ( documentElement.getRootNode ) { // Provide a fallback for browsers without Shadow DOM v1 support.
if ( !documentElement.getRootNode ) {
isAttached = function( elem ) { isAttached = function( elem ) {
return jQuery.contains( elem.ownerDocument, elem ) || return jQuery.contains( elem.ownerDocument, elem );
elem.getRootNode( composed ) === elem.ownerDocument;
}; };
} }

View File

@ -11,7 +11,6 @@ import getStyles from "./css/var/getStyles.js";
import swap from "./css/var/swap.js"; import swap from "./css/var/swap.js";
import curCSS from "./css/curCSS.js"; import curCSS from "./css/curCSS.js";
import adjustCSS from "./css/adjustCSS.js"; import adjustCSS from "./css/adjustCSS.js";
import support from "./css/support.js";
import finalPropName from "./css/finalPropName.js"; import finalPropName from "./css/finalPropName.js";
import "./core/init.js"; import "./core/init.js";
@ -135,15 +134,19 @@ function getWidthOrHeight( elem, dimension, extra ) {
} }
// Support: IE 9 - 11+ if ( ( isIE &&
// 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 ||
// Support: IE 10 - 11+, Edge 15 - 18+ // Support: IE 9 - 11+
// IE/Edge misreport `getComputedStyle` of table rows with width/height // Use offsetWidth/offsetHeight for when box sizing is unreliable.
// set in CSS while `offset*` properties report correct values. // In those cases, the computed value can be trusted to be border-box.
!support.reliableTrDimensions() && nodeName( elem, "tr" ) || 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" // Fall back to offsetWidth/offsetHeight when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571) // This happens for inline elements with no explicit setting (gh-3571)

View File

@ -5,7 +5,7 @@ var rmsPrefix = /^-ms-/;
// Convert dashed to camelCase, handle vendor prefixes. // Convert dashed to camelCase, handle vendor prefixes.
// Used by the css & effects modules. // 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) // Microsoft forgot to hump their vendor prefix (#9572)
function cssCamelCase( string ) { function cssCamelCase( string ) {
return camelCase( string.replace( rmsPrefix, "ms-" ) ); return camelCase( string.replace( rmsPrefix, "ms-" ) );

View File

@ -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;

5
src/effects.js vendored
View File

@ -143,10 +143,9 @@ function defaultPrefilter( elem, props, opts ) {
// Restrict "overflow" and "display" styles during box animations // Restrict "overflow" and "display" styles during box animations
if ( isBox && elem.nodeType === 1 ) { 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 // Record all 3 overflow attributes because IE does not infer the shorthand
// from identically-valued overflowX and overflowY and Edge just mirrors // from identically-valued overflowX and overflowY.
// the overflowX value there.
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Identify a display type, preferring old show/hide data over the CSS cascade // Identify a display type, preferring old show/hide data over the CSS cascade

View File

@ -23,9 +23,8 @@ import "./event.js";
var var
// Support: IE <=10 - 11+, Edge 12 - 13 only // Support: IE <=10 - 11+
// In IE/Edge using regex groups here causes severe slowdowns. // In IE using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i, rnoInnerhtml = /<script|<style|<link/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 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 // Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl && !node.noModule ) { if ( jQuery._evalUrl && !node.noModule ) {
jQuery._evalUrl( node.src, { jQuery._evalUrl( node.src, {
nonce: node.nonce || node.getAttribute( "nonce" ), nonce: node.nonce,
crossOrigin: node.crossOrigin crossOrigin: node.crossOrigin
}, doc ); }, doc );
} }

View File

@ -7,7 +7,7 @@ import pop from "./var/pop.js";
import push from "./var/push.js"; import push from "./var/push.js";
import whitespace from "./selector/var/whitespace.js"; import whitespace from "./selector/var/whitespace.js";
import rbuggyQSA from "./selector/rbuggyQSA.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. // The following utils are attached directly to the jQuery object.
import "./selector/contains.js"; import "./selector/contains.js";
@ -131,9 +131,9 @@ var i,
}, },
// Used for iframes; see `setDocument`. // Used for iframes; see `setDocument`.
// Support: IE 9 - 11+, Edge 12 - 18+ // Support: IE 9 - 11+
// Removing the function wrapper causes a "Permission Denied" // Removing the function wrapper causes a "Permission Denied"
// error in IE/Edge. // error in IE.
unloadHandler = function() { unloadHandler = function() {
setDocument(); setDocument();
}, },
@ -229,9 +229,9 @@ function find( selector, context, results, seed ) {
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
context; context;
// We can use :scope instead of the ID hack if the browser // Outside of IE, if we're not changing the context we can
// supports it & if we're not changing the context. // use :scope instead of an ID.
if ( newContext !== context || !support.scope ) { if ( newContext !== context || isIE ) {
// Capture the context ID, setting it first if necessary // Capture the context ID, setting it first if necessary
if ( ( nid = context.getAttribute( "id" ) ) ) { if ( ( nid = context.getAttribute( "id" ) ) ) {
@ -360,7 +360,6 @@ function createDisabledPseudo( disabled ) {
return elem.isDisabled === disabled || return elem.isDisabled === disabled ||
// Where there is no isDisabled, check manually // Where there is no isDisabled, check manually
/* jshint -W018 */
elem.isDisabled !== !disabled && elem.isDisabled !== !disabled &&
inDisabledFieldset( elem ) === disabled; inDisabledFieldset( elem ) === disabled;
} }
@ -419,8 +418,8 @@ function setDocument( node ) {
doc = node ? node.ownerDocument || node : preferredDoc; doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected // Return early if doc is invalid or already selected
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if ( doc == document || doc.nodeType !== 9 ) { if ( doc == document || doc.nodeType !== 9 ) {
@ -432,16 +431,14 @@ function setDocument( node ) {
documentElement = document.documentElement; documentElement = document.documentElement;
documentIsHTML = !jQuery.isXMLDoc( document ); 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) // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if ( preferredDoc != document && if ( isIE && preferredDoc != document &&
( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
// Support: IE 9 - 11+, Edge 12 - 18+
subWindow.addEventListener( "unload", unloadHandler ); subWindow.addEventListener( "unload", unloadHandler );
} }
} }
@ -928,7 +925,7 @@ Expr = jQuery.expr = {
// Accessing the selectedIndex property // Accessing the selectedIndex property
// forces the browser to treat the default option as // forces the browser to treat the default option as
// selected when in an optgroup. // selected when in an optgroup.
if ( elem.parentNode ) { if ( isIE && elem.parentNode ) {
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
@ -1412,8 +1409,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
if ( outermost ) { if ( outermost ) {
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
outermostContext = context == document || context || outermost; outermostContext = context == document || context || outermost;
@ -1424,8 +1421,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
if ( byElement && elem ) { if ( byElement && elem ) {
j = 0; j = 0;
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if ( !context && elem.ownerDocument != document ) { if ( !context && elem.ownerDocument != document ) {

View File

@ -1,29 +1,19 @@
import document from "../var/document.js";
import isIE from "../var/isIE.js"; import isIE from "../var/isIE.js";
import whitespace from "./var/whitespace.js"; import whitespace from "./var/whitespace.js";
var rbuggyQSA = [], var rbuggyQSA = isIE && new RegExp(
testEl = document.createElement( "div" ),
input = document.createElement( "input" );
// Support: IE 9 - 11+ // Support: IE 9 - 11+
// IE's :disabled selector does not pick up the children of disabled fieldsets // IE's :disabled selector does not pick up the children of disabled fieldsets
if ( isIE ) { ":enabled|:disabled|" +
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Support: IE 11+, Edge 15 - 18+ // Support: IE 11+
// IE 11/Edge don't find elements on a `[name='']` query in some cases. // IE 11 doesn't find elements on a `[name='']` query in some cases.
// Adding a temporary attribute to the document before the selection works // Adding a temporary attribute to the document before the selection works
// around the issue. // around the issue.
// Interestingly, IE 10 & older don't seem to have the issue. "\\[" + whitespace + "*name" + whitespace + "*=" +
input.setAttribute( "name", "" ); whitespace + "*(?:''|\"\")"
testEl.appendChild( input );
if ( !testEl.querySelectorAll( "[name='']" ).length ) {
rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
whitespace + "*(?:''|\"\")" );
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); );
export default rbuggyQSA; export default rbuggyQSA;

View File

@ -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;

View File

@ -20,8 +20,8 @@ function sortOrder( a, b ) {
} }
// Calculate position if both inputs belong to the same document // Calculate position if both inputs belong to the same document
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
@ -34,8 +34,8 @@ function sortOrder( a, b ) {
if ( compare & 1 ) { if ( compare & 1 ) {
// Choose the first element that is related to the document // Choose the first element that is related to the document
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if ( a == document || a.ownerDocument == document && if ( a == document || a.ownerDocument == document &&
@ -43,8 +43,8 @@ function sortOrder( a, b ) {
return -1; return -1;
} }
// Support: IE 11+, Edge 17 - 18+ // Support: IE 11+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing // IE sometimes throws a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work. // two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if ( b == document || b.ownerDocument == document && if ( b == document || b.ownerDocument == document &&

View File

@ -1,7 +1,7 @@
import arr from "./arr.js"; import arr from "./arr.js";
// Support: IE 11+, Edge 18+ // Support: IE 11+
// Provide fallback for browsers without Array#flat. // IE doesn't have Array#flat; provide a fallback.
export default arr.flat ? function( array ) { export default arr.flat ? function( array ) {
return arr.flat.call( array ); return arr.flat.call( array );
} : function( array ) { } : function( array ) {

4
test/jquery.js vendored
View File

@ -58,8 +58,8 @@
// This doesn't apply to iframes because they synchronously expect jQuery to be there. // This doesn't apply to iframes because they synchronously expect jQuery to be there.
if ( config.esmodules && QUnit ) { if ( config.esmodules && QUnit ) {
// Support: IE 11+, Edge 12 - 18+ // Support: IE 11+
// IE/Edge don't support the dynamic import syntax so they'd crash // IE doesn't support the dynamic import syntax so it would crash
// with a SyntaxError here. // with a SyntaxError here.
dynamicImportSource = "" + dynamicImportSource = "" +
"import( `${ parentUrl }src/jquery.js` )\n" + "import( `${ parentUrl }src/jquery.js` )\n" +

View File

@ -271,7 +271,7 @@ QUnit.module( "ajax", {
"Nullable": null, "Nullable": null,
"undefined": undefined "undefined": undefined
// Support: IE 9 - 11+, Edge 12 - 14 only // Support: IE 9 - 11+
// IE can receive empty headers but not send them. // IE can receive empty headers but not send them.
}, QUnit.isIE ? {} : { }, QUnit.isIE ? {} : {
"Empty": "" "Empty": ""
@ -2281,9 +2281,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
// beforeunload, unload, pagehide, and visibilitychange event handlers. // beforeunload, unload, pagehide, and visibilitychange event handlers.
// See https://bugs.chromium.org/p/chromium/issues/detail?id=952452 // See https://bugs.chromium.org/p/chromium/issues/detail?id=952452
// Safari 13 did similar changes. The below check will catch them both. // 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 if ( !/safari/i.test( navigator.userAgent ) ) {
// to exclude Edge specifically here so that the test continues to run there.
if ( !/safari/i.test( navigator.userAgent ) || /edge\//i.test( navigator.userAgent ) ) {
testIframe( testIframe(
"#14379 - jQuery.ajax() on unload", "#14379 - jQuery.ajax() on unload",
"ajax/onunload.html", "ajax/onunload.html",

View File

@ -801,15 +801,15 @@ QUnit.test( "jQuery.map", function( assert ) {
assert.equal( result.length, 3, "Array flatten only one level down" ); assert.equal( result.length, 3, "Array flatten only one level down" );
assert.ok( Array.isArray( result[ 0 ] ), "Array flatten only one level down" ); assert.ok( Array.isArray( result[ 0 ] ), "Array flatten only one level down" );
// Support: IE 11+, Edge 18+ // Support: IE 11+
// Skip the test in browsers without Array#flat. // IE doesn't have Array#flat so it'd fail the test.
if ( Array.prototype.flat ) { if ( !QUnit.isIE ) {
result = jQuery.map( Array( 300000 ), function( v, k ) { result = jQuery.map( Array( 300000 ), function( v, k ) {
return k; return k;
} ); } );
assert.equal( result.length, 300000, "Able to map 300000 records without any problems (#4320)" ); assert.equal( result.length, 300000, "Able to map 300000 records without any problems (#4320)" );
} else { } else {
assert.ok( "skip", "Array#flat doesn't supported on all browsers" ); assert.ok( "skip", "Array#flat isn't supported in IE" );
} }
} ); } );

View File

@ -638,9 +638,9 @@ QUnit.test( "show/hide detached nodes", function( assert ) {
span.remove(); span.remove();
} ); } );
// Support: IE 11+, Edge 12 - 18+ // Support: IE 11+
// IE/Edge don't support Shadow DOM. // IE doesn't support Shadow DOM.
QUnit[ document.body.getRootNode ? "test" : "skip" ]( QUnit.testUnlessIE(
"show/hide shadow child nodes", function( assert ) { "show/hide shadow child nodes", function( assert ) {
assert.expect( 28 ); assert.expect( 28 );
@ -1022,7 +1022,7 @@ QUnit[ QUnit.jQuerySelectors && jQuery.fn.toggle ? "test" : "skip" ]( "detached
"cascade-hidden element in detached tree" ); "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 ) { "shadow toggle()", function( assert ) {
assert.expect( 4 ); assert.expect( 4 );
@ -1758,9 +1758,7 @@ QUnit.testUnlessIE( "css(--customProperty)", function( assert ) {
var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ), var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
$elem = jQuery( "<div>" ).addClass( "test__customProperties" ) $elem = jQuery( "<div>" ).addClass( "test__customProperties" )
.appendTo( "#qunit-fixture" ), .appendTo( "#qunit-fixture" ),
webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ) && webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ),
!/\bfirefox\b/i.test( navigator.userAgent ) &&
!/\bedge\b/i.test( navigator.userAgent ),
expected = 10; expected = 10;
if ( webkitOrBlink ) { if ( webkitOrBlink ) {

View File

@ -629,10 +629,6 @@ QUnit.test( ".data always sets data with the camelCased key (gh-2257)", function
key: "boolFalse", key: "boolFalse",
value: false value: false
}, },
// JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": { "some-json": {
key: "someJson", key: "someJson",
value: "{ \"foo\": \"bar\" }" value: "{ \"foo\": \"bar\" }"
@ -693,10 +689,6 @@ QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of proper
key: "boolFalse", key: "boolFalse",
value: false value: false
}, },
// JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": { "some-json": {
key: "someJson", key: "someJson",
value: "{ \"foo\": \"bar\" }" value: "{ \"foo\": \"bar\" }"
@ -756,10 +748,6 @@ QUnit.test( ".data supports interoperable removal of hyphenated/camelCase proper
"an-object": {}, "an-object": {},
"bool-true": true, "bool-true": true,
"bool-false": false, "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\" }" "some-json": "{ \"foo\": \"bar\" }"
}; };
@ -797,10 +785,6 @@ QUnit.test( ".data supports interoperable removal of properties SET TWICE #13850
"an-object": {}, "an-object": {},
"bool-true": true, "bool-true": true,
"bool-false": false, "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\" }" "some-json": "{ \"foo\": \"bar\" }"
}; };

View File

@ -216,9 +216,9 @@ supportjQuery.each( hideOptions, function( type, setup ) {
clock.tick( 300 ); clock.tick( 300 );
} ); } );
// Support: IE 11+, Edge 12 - 18+ // Support: IE 11+
// IE/Edge don't support Shadow DOM. // IE doesn't support Shadow DOM.
QUnit[ document.body.getRootNode ? "test" : "skip" ]( QUnit.testUnlessIE(
"Persist correct display value - " + type + " hidden, shadow child", function( assert ) { "Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
assert.expect( 3 ); assert.expect( 3 );

View File

@ -1762,13 +1762,9 @@ QUnit.test( "html(Function)", function( assert ) {
testHtml( manipulationFunctionReturningObj, assert ); testHtml( manipulationFunctionReturningObj, assert );
} ); } );
QUnit[ // Support: IE 9 - 11+
// Support: Edge 16 - 18+ // IE doesn't support modules.
// Edge sometimes doesn't execute module scripts so skip the test there. QUnit.testUnlessIE( "html(script type module)", function( assert ) {
( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ?
"skip" :
"test"
]( "html(script type module)", function( assert ) {
assert.expect( 4 ); assert.expect( 4 );
var done = assert.async(), var done = assert.async(),
$fixture = jQuery( "#qunit-fixture" ); $fixture = jQuery( "#qunit-fixture" );
@ -2897,12 +2893,7 @@ testIframe(
assert.equal( data, "", "No log request should be sent" ); assert.equal( data, "", "No log request should be sent" );
supportjQuery.get( baseURL + "mock.php?action=cspClean" ).done( done ); 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( testIframe(
@ -2920,10 +2911,7 @@ testIframe(
}, },
// The AJAX module is needed for jQuery._evalUrl. // The AJAX module is needed for jQuery._evalUrl.
// Support: Edge <=18+ QUnit[ jQuery.ajax ? "test" : "skip" ]
// 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" ]
); );
testIframe( testIframe(
@ -2938,12 +2926,7 @@ testIframe(
assert.equal( data, "", "No log request should be sent" ); assert.equal( data, "", "No log request should be sent" );
supportjQuery.get( baseURL + "mock.php?action=cspClean" ).done( done ); 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 ) { QUnit.test( "Sanitized HTML doesn't get unsanitized", function( assert ) {

View File

@ -1661,14 +1661,10 @@ QUnit.test( "context", function( assert ) {
} }
} ); } );
// Support: IE 11+, Edge 12 - 18+ // Support: IE 11+
// IE/Edge don't support the :scope pseudo-class so they will trigger MutationObservers. // IE doesn't support the :scope pseudo-class so it will trigger MutationObservers.
// The test is skipped there. // The test is skipped there.
QUnit[ QUnit.testUnlessIE( "selectors maintaining context don't trigger mutation observers", function( assert ) {
( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ?
"skip" :
"test"
]( "selectors maintaining context don't trigger mutation observers", function( assert ) {
assert.expect( 1 ); assert.expect( 1 );
var timeout, var timeout,
@ -1742,10 +1738,10 @@ QUnit[ QUnit.jQuerySelectors ? "test" : "skip" ]( "disconnected nodes", function
assert.equal( $opt.is( ":selected" ), true, "selected option" ); assert.equal( $opt.is( ":selected" ), true, "selected option" );
} ); } );
// Support: IE 11+, Edge 12 - 18+ // Support: IE 11+
// IE/Edge don't support Shadow DOM. // IE doesn't support Shadow DOM.
// selector-native doesn't support querying inside of 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 ) { "Shadow DOM nodes supported as root", function( assert ) {
assert.expect( 2 ); assert.expect( 2 );

View File

@ -58,39 +58,18 @@ testIframe(
var expected, var expected,
userAgent = window.navigator.userAgent, userAgent = window.navigator.userAgent,
expectedMap = { expectedMap = {
edge: { ie_11: {},
reliableTrDimensions: false, chrome: {},
scope: undefined safari: {},
}, firefox: {},
ie_11: { ios: {}
reliableTrDimensions: false,
scope: undefined
},
chrome: {
reliableTrDimensions: true,
scope: true
},
safari: {
reliableTrDimensions: true,
scope: true
},
firefox: {
reliableTrDimensions: true,
scope: true
},
ios: {
reliableTrDimensions: true,
scope: true
}
}; };
if ( /edge\//i.test( userAgent ) ) { if ( document.documentMode ) {
expected = expectedMap.edge;
} else if ( document.documentMode ) {
expected = expectedMap.ie_11; expected = expectedMap.ie_11;
} else if ( /chrome/i.test( userAgent ) ) { } else if ( /chrome/i.test( userAgent ) ) {
// Catches Chrome on Android & Opera as well. // Catches Edge, Chrome on Android & Opera as well.
expected = expectedMap.chrome; expected = expectedMap.chrome;
} else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) { } else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) {
expected = expectedMap.safari; expected = expectedMap.safari;