From 89ef81f86f8f371154e9fd3173be5fb57cb72d5e 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:25:20 +0200 Subject: [PATCH] Tests: Indicate Chrome 112 & Safari 16.4 pass the cssHas support test 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-5225 --- src/selector/support.js | 4 ++-- test/unit/support.js | 38 +++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/selector/support.js b/src/selector/support.js index 396e0e046..572038747 100644 --- a/src/selector/support.js +++ b/src/selector/support.js @@ -1,8 +1,8 @@ import document from "../var/document.js"; import support from "../var/support.js"; -// 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 2bf43112f..05e669de3 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -62,21 +62,25 @@ testIframe( cssHas: true, reliableTrDimensions: false }, - chrome: { + chrome_111: { cssHas: false, reliableTrDimensions: true }, - safari: { + chrome: { + cssHas: true, + reliableTrDimensions: true + }, + safari_16_3: { cssHas: false, reliableTrDimensions: true }, - webkit: { + safari: { cssHas: true, reliableTrDimensions: true }, - firefox_102: { + webkit: { cssHas: true, - reliableTrDimensions: false + reliableTrDimensions: true }, firefox: { cssHas: true, @@ -86,9 +90,13 @@ testIframe( cssHas: true, reliableTrDimensions: true }, - ios: { + ios_15_4_16_3: { cssHas: false, reliableTrDimensions: true + }, + ios: { + cssHas: true, + reliableTrDimensions: true } }; @@ -101,17 +109,19 @@ testIframe( if ( document.documentMode ) { expected = expectedMap.ie_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 Edge, Chrome on Android & Opera as well. expected = expectedMap.chrome; - } else if ( /firefox\/102\./i.test( userAgent ) ) { - expected = expectedMap.firefox_102; - } else if ( /firefox/i.test( userAgent ) ) { + } else if ( /\bfirefox\//i.test( userAgent ) ) { expected = expectedMap.firefox; - } else if ( /iphone os (?:14_|15_[0123])/i.test( userAgent ) ) { + } else if ( /\biphone os (?:14_|15_[0123])/i.test( userAgent ) ) { expected = expectedMap.ios_14_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" && @@ -125,7 +135,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