<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>227391</bug_id>
          
          <creation_ts>2021-06-25 02:29:43 -0700</creation_ts>
          <short_desc>MobileSafari cannot parse `@supports selector(…)`</short_desc>
          <delta_ts>2021-06-25 15:06:20 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Other</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bramus">bramus</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1772595</commentid>
    <comment_count>0</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-06-25 02:29:43 -0700</bug_when>
    <thetext>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&apos;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&apos;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 &quot;Further Findings 2&quot; example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1772599</commentid>
    <comment_count>1</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-06-25 02:40:19 -0700</bug_when>
    <thetext>By extension, after some further testing: MobileSafari simply does not understand `@supports selector(…)`.

See https://codepen.io/bramus/pen/2abd4b7e1d411fa687295f0697e294d4 for a demo.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1772734</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-06-25 11:35:54 -0700</bug_when>
    <thetext>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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1772769</commentid>
    <comment_count>3</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2021-06-25 15:06:20 -0700</bug_when>
    <thetext>I see that my phone still was on iOS 14.4. Testing on 14.6 indeed confirms it works. Thanks!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>