Skip to content

Commit 89ef81f

Browse files
committed
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
1 parent bce13b7 commit 89ef81f

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

src/selector/support.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import document from "../var/document.js";
22
import support from "../var/support.js";
33

4-
// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
5-
// Make sure the the `:has()` argument is parsed unforgivingly.
4+
// Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
5+
// Make sure the `:has()` argument is parsed unforgivingly.
66
// We include `*` in the test to detect buggy implementations that are
77
// _selectively_ forgiving (specifically when the list includes at least
88
// one valid selector).

test/unit/support.js

+25-13
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,25 @@ testIframe(
6262
cssHas: true,
6363
reliableTrDimensions: false
6464
},
65-
chrome: {
65+
chrome_111: {
6666
cssHas: false,
6767
reliableTrDimensions: true
6868
},
69-
safari: {
69+
chrome: {
70+
cssHas: true,
71+
reliableTrDimensions: true
72+
},
73+
safari_16_3: {
7074
cssHas: false,
7175
reliableTrDimensions: true
7276
},
73-
webkit: {
77+
safari: {
7478
cssHas: true,
7579
reliableTrDimensions: true
7680
},
77-
firefox_102: {
81+
webkit: {
7882
cssHas: true,
79-
reliableTrDimensions: false
83+
reliableTrDimensions: true
8084
},
8185
firefox: {
8286
cssHas: true,
@@ -86,9 +90,13 @@ testIframe(
8690
cssHas: true,
8791
reliableTrDimensions: true
8892
},
89-
ios: {
93+
ios_15_4_16_3: {
9094
cssHas: false,
9195
reliableTrDimensions: true
96+
},
97+
ios: {
98+
cssHas: true,
99+
reliableTrDimensions: true
92100
}
93101
};
94102

@@ -101,17 +109,19 @@ testIframe(
101109

102110
if ( document.documentMode ) {
103111
expected = expectedMap.ie_11;
104-
} else if ( /chrome/i.test( userAgent ) ) {
112+
} else if ( /\b(?:headless)?chrome\/(?:10\d|11[01])\b/i.test( userAgent ) ) {
113+
expected = expectedMap.chrome_111;
114+
} else if ( /\b(?:headless)?chrome\//i.test( userAgent ) ) {
105115

106116
// Catches Edge, Chrome on Android & Opera as well.
107117
expected = expectedMap.chrome;
108-
} else if ( /firefox\/102\./i.test( userAgent ) ) {
109-
expected = expectedMap.firefox_102;
110-
} else if ( /firefox/i.test( userAgent ) ) {
118+
} else if ( /\bfirefox\//i.test( userAgent ) ) {
111119
expected = expectedMap.firefox;
112-
} else if ( /iphone os (?:14_|15_[0123])/i.test( userAgent ) ) {
120+
} else if ( /\biphone os (?:14_|15_[0123])/i.test( userAgent ) ) {
113121
expected = expectedMap.ios_14_15_3;
114-
} else if ( /(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) {
122+
} else if ( /\biphone os (?:15_|16_[0123])/i.test( userAgent ) ) {
123+
expected = expectedMap.ios_15_4_16_3;
124+
} else if ( /\b(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) {
115125
expected = expectedMap.ios;
116126
} else if ( typeof URLSearchParams !== "undefined" &&
117127

@@ -125,7 +135,9 @@ testIframe(
125135
) === "Playwright"
126136
) {
127137
expected = expectedMap.webkit;
128-
} else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) {
138+
} else if ( /\bversion\/(?:15|16\.[0123])(?:\.\d+)* safari/i.test( userAgent ) ) {
139+
expected = expectedMap.safari_16_3;
140+
} else if ( /\bversion\/\d+(?:\.\d+)+ safari/i.test( userAgent ) ) {
129141
expected = expectedMap.safari;
130142
}
131143

0 commit comments

Comments
 (0)