Bug 227391

Summary: MobileSafari cannot parse `@supports selector(…)`
Product: WebKit Reporter: Bramus <bramus>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ap
Priority: P2    
Version: Other   
Hardware: iPhone / iPad   
OS: Unspecified   

Bramus
Reported 2021-06-25 02:29:43 PDT
Safari/MobileSafari currently are the only browsers that support the `:nth-child(An+B [of S]?)` selector. When checking for support for `:nth-child(An+B [of S]?)` using @supports, only Safari on Desktop claims it does; MobileSafari does not understand the rule. ``` @supports selector(:nth-child(1 of x)) { /* BUG: Only targets Desktop Safari, although MobileSafari also supports the selector … */ … } ``` See demo at https://codepen.io/bramus/pen/3c476384f0adadd65a0b53db15f86cf4 - Safari: The background is hotpink - MobileSafari: The background remains the default color Further findings: 1. MobileSafari's parsing breaks on `selector(:nth-child(1 of x))`. Extending the @supports rule with a check for `-webkit-touch-callout: none` (which MobileSafari does understand) does nothing. ``` @supports selector(:nth-child(1 of x)) or (-webkit-touch-callout: none) { … } ``` 2. When adding extra parens around the `selector()` MobileSafari does seem to be able to parse the expression: ``` @supports (selector(:nth-child(1 of x))) or (-webkit-touch-callout: none) { … } ``` 3. Singling out `selector()` with extra parens added also doesn't work on MobileSafari: ``` @supports (selector(:nth-child(1 of x))) { … } ``` It is expected that MobileSafari understands all code examples shown, whereas now it only understands the syntax used in the "Further Findings 2" example.
Attachments
Bramus
Comment 1 2021-06-25 02:40:19 PDT
By extension, after some further testing: MobileSafari simply does not understand `@supports selector(…)`. See https://codepen.io/bramus/pen/2abd4b7e1d411fa687295f0697e294d4 for a demo.
Alexey Proskuryakov
Comment 2 2021-06-25 11:35:54 PDT
I cannot reproduce this on iOS 14.6 or iOS 15 beta. Not sure what could be different in your testing. Any chance that you were using an older iOS version?
Bramus
Comment 3 2021-06-25 15:06:20 PDT
I see that my phone still was on iOS 14.4. Testing on 14.6 indeed confirms it works. Thanks!
Note You need to log in before you can comment on or make changes to this bug.