<?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>290584</bug_id>
          
          <creation_ts>2025-03-27 16:36:55 -0700</creation_ts>
          <short_desc>Invalid nested selectors cause subsequent property-value pair to be ignored</short_desc>
          <delta_ts>2025-03-28 09:44:17 -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>Safari 18</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>285114</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=285114</see_also>
          <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>lx2798</reporter>
          <assigned_to name="Matthieu Dubet">m_dubet</assigned_to>
          <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>lwarlow</cc>
    
    <cc>m_dubet</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2106640</commentid>
    <comment_count>0</comment_count>
    <who name="">lx2798</who>
    <bug_when>2025-03-27 16:36:55 -0700</bug_when>
    <thetext>Suppose you have the following nested selector:

```
div {
  font-weight: bold;
  
  &amp;::-foo-bar {
    font-size: 50px;
  }
  
  color: blue;
  text-transform: uppercase;
}
```

The nested `&amp;::-foo-bar` rule is invalid and ignored (which is expected), but so is `color: blue`. The `text-transform: uppercase` seems to be processed just fine though. It&apos;s as if there&apos;s some logic invalidating everything up to the next `;` after an invalid selector.

This bug also invalidates any immediately subsequent nested rule as well, which is particularly annoying because one use case for nested rules is to handle Mozilla-specific `-moz-` selectors:

```
input[type=&quot;range&quot;] {
    &amp;::-moz-range-thumb { /* some styling */ }
    &amp;::-webkit-slider-thumb { /* some styling */ }
}
``` 

In this case, the invalid (from WebKit&apos;s perspective) `-moz-range-thumb` also invalidates the `-webkit-slider-thumb` (and any nested rule or property-value after that until a `;` is encountered).

Repro at https://codepen.io/andrewfong/pen/RNwYqLr

This bug does not seem to happen with Mozilla and Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2106649</commentid>
    <comment_count>1</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2025-03-27 16:57:56 -0700</bug_when>
    <thetext>From a quick search it seems to be https://searchfox.org/wubkat/source/Source/WebCore/css/parser/CSSParserImpl.cpp#1453 which needs changing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2106836</commentid>
    <comment_count>2</comment_count>
    <who name="Matthieu Dubet">m_dubet</who>
    <bug_when>2025-03-28 09:44:17 -0700</bug_when>
    <thetext>Hi,

Thank you for the bug report. It seems to be a duplicate of 285114

Safari Technology Preview and Chrome Dev are displaying the same result in the codepen.

*** This bug has been marked as a duplicate of bug 285114 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>