From 1a4d87afa08a68d81c38172ca10941e25633c323 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Wed, 5 Apr 2023 00:44:01 +0200 Subject: [PATCH] Tests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (3.x version) Chrome 112 & Safari 16.4 introduce two changes: * `:has()` is non-forgiving * `CSS.supports( "selector(...)" )` parses everything in a non-forgiving way We no longer care about the latter but the former means the `cssHas` support test now passes. Closes gh-5226 --- src/selector.js | 4 +- test/unit/support.js | 102 ++++++++++++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/src/selector.js b/src/selector.js index 49d29c908..406bf49f4 100644 --- a/src/selector.js +++ b/src/selector.js @@ -558,8 +558,8 @@ function setDocument( node ) { return document.querySelectorAll( ":scope" ); } ); - // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ - // Make sure the the `:has()` argument is parsed unforgivingly. + // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only + // Make sure the `:has()` argument is parsed unforgivingly. // We include `*` in the test to detect buggy implementations that are // _selectively_ forgiving (specifically when the list includes at least // one valid selector). diff --git a/test/unit/support.js b/test/unit/support.js index 5be7491e6..db9eda662 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -130,7 +130,7 @@ testIframe( sortDetached: true, sortStable: true }, - chrome: { + chrome_111: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -154,7 +154,31 @@ testIframe( sortDetached: true, sortStable: true }, - safari: { + chrome: { + ajax: true, + boxSizingReliable: true, + checkClone: true, + checkOn: true, + clearCloneStyle: true, + cssHas: true, + cors: true, + createHTMLDocument: true, + disconnectedMatch: true, + getById: true, + noCloneChecked: true, + option: true, + optSelected: true, + pixelBoxStyles: true, + pixelPosition: true, + radioValue: true, + reliableMarginLeft: true, + reliableTrDimensions: true, + scope: true, + scrollboxSize: true, + sortDetached: true, + sortStable: true + }, + safari_16_3: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -178,7 +202,7 @@ testIframe( sortDetached: true, sortStable: true }, - webkit: { + safari: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -202,7 +226,7 @@ testIframe( sortDetached: true, sortStable: true }, - firefox_60: { + webkit: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -219,14 +243,14 @@ testIframe( pixelBoxStyles: true, pixelPosition: true, radioValue: true, - reliableMarginLeft: false, + reliableMarginLeft: true, reliableTrDimensions: true, scope: true, scrollboxSize: true, sortDetached: true, sortStable: true }, - firefox_102: { + firefox_60: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -243,8 +267,8 @@ testIframe( pixelBoxStyles: true, pixelPosition: true, radioValue: true, - reliableMarginLeft: true, - reliableTrDimensions: false, + reliableMarginLeft: false, + reliableTrDimensions: true, scope: true, scrollboxSize: true, sortDetached: true, @@ -370,7 +394,7 @@ testIframe( sortDetached: true, sortStable: true }, - ios: { + ios_15_4_16_3: { ajax: true, boxSizingReliable: true, checkClone: true, @@ -394,6 +418,30 @@ testIframe( sortDetached: true, sortStable: true }, + ios: { + ajax: true, + boxSizingReliable: true, + checkClone: true, + checkOn: true, + clearCloneStyle: true, + cssHas: true, + cors: true, + createHTMLDocument: true, + disconnectedMatch: true, + getById: true, + noCloneChecked: true, + option: true, + optSelected: true, + pixelBoxStyles: true, + pixelPosition: true, + radioValue: true, + reliableMarginLeft: true, + reliableTrDimensions: true, + scope: true, + scrollboxSize: true, + sortDetached: true, + sortStable: true + }, android: { ajax: true, boxSizingReliable: true, @@ -440,36 +488,36 @@ testIframe( } } - if ( /edge\//i.test( userAgent ) ) { + if ( /\bedge\//i.test( userAgent ) ) { expected = expectedMap.edge; - } else if ( /msie 9\.0/i.test( userAgent ) ) { + } else if ( /\bmsie 9\.0/i.test( userAgent ) ) { expected = expectedMap.ie_9; - } else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) { + } else if ( /\b(?:msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) { expected = expectedMap.ie_10_11; - } else if ( /chrome/i.test( userAgent ) ) { + } else if ( /\b(?:headless)?chrome\/(?:10\d|11[01])\b/i.test( userAgent ) ) { + expected = expectedMap.chrome_111; + } else if ( /\b(?:headless)?chrome\//i.test( userAgent ) ) { // Catches Chrome on Android as well (i.e. the default // Android browser on Android >= 4.4). expected = expectedMap.chrome; - } else if ( /\b(?:9|10)\.\d+(\.\d+)* safari/i.test( userAgent ) ) { - expected = expectedMap.safari_9_10; - } else if ( /firefox\/[456]\d\b/i.test( userAgent ) ) { + } else if ( /\bfirefox\/[456]\d\b/i.test( userAgent ) ) { expected = expectedMap.firefox_60; - } else if ( /firefox\/(?:[789]\d|102)\b/i.test( userAgent ) ) { - expected = expectedMap.firefox_102; - } else if ( /firefox/i.test( userAgent ) ) { + } else if ( /\bfirefox\//i.test( userAgent ) ) { expected = expectedMap.firefox; - } else if ( /android 4\.[0-3]/i.test( userAgent ) ) { + } else if ( /\bandroid 4\.[0-3]/i.test( userAgent ) ) { expected = expectedMap.android; - } else if ( /iphone os 7_/i.test( userAgent ) ) { + } else if ( /\biphone os 7_/i.test( userAgent ) ) { expected = expectedMap.ios_7; - } else if ( /iphone os 8_/i.test( userAgent ) ) { + } else if ( /\biphone os 8_/i.test( userAgent ) ) { expected = expectedMap.ios_8; - } else if ( /iphone os (?:9|10)_/i.test( userAgent ) ) { + } else if ( /\biphone os (?:9|10)_/i.test( userAgent ) ) { expected = expectedMap.ios_9_10; - } else if ( /iphone os (?:1[1234]_|15_[0123])/i.test( userAgent ) ) { + } else if ( /\biphone os (?:1[1234]_|15_[0123])/i.test( userAgent ) ) { expected = expectedMap.ios_11_15_3; - } else if ( /(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) { + } else if ( /\biphone os (?:15_|16_[0123])/i.test( userAgent ) ) { + expected = expectedMap.ios_15_4_16_3; + } else if ( /\b(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) { expected = expectedMap.ios; } else if ( typeof URLSearchParams !== "undefined" && @@ -483,7 +531,9 @@ testIframe( ) === "Playwright" ) { expected = expectedMap.webkit; - } else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) { + } else if ( /\bversion\/(?:15|16\.[0123])(?:\.\d+)* safari/i.test( userAgent ) ) { + expected = expectedMap.safari_16_3; + } else if ( /\bversion\/\d+(?:\.\d+)+ safari/i.test( userAgent ) ) { expected = expectedMap.safari; } -- 2.39.5