<?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>261366</bug_id>
          
          <creation_ts>2023-09-08 19:56:02 -0700</creation_ts>
          <short_desc>Elements with :has(+ sibling) selectors do not update when their siblings change</short_desc>
          <delta_ts>2023-10-21 14:24:56 -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>WebKit Nightly Build</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 13</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>tlf</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>benjamin.mark.adam</cc>
    
    <cc>heycam</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1976581</commentid>
    <comment_count>0</comment_count>
      <attachid>467614</attachid>
    <who name="">tlf</who>
    <bug_when>2023-09-08 19:56:02 -0700</bug_when>
    <thetext>Created attachment 467614
Simple test case

When styling an element using a :has(+ sibling) or :has(~ sibling) selector, adding/removing siblings of the element doesn&apos;t invalidate the styles. I originally found and reported this issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1851356.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1976691</commentid>
    <comment_count>1</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2023-09-10 01:10:14 -0700</bug_when>
    <thetext>I think we&apos;d either need to extend the &quot;invalidate a lot&quot; patch I have in https://bugs.webkit.org/show_bug.cgi?id=253944 to handle such selectors, or (and this is probably better) we need to store :has(+) and :has(~) rules separately on RuleFeature / StyleScopeRuleSet, then look at the style relation bits that we set on elements to determine whether we need to invalidate those rules on some or all of the siblings of the inserted or removed element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1976692</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-09-10 01:16:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/115242090&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1979406</commentid>
    <comment_count>3</comment_count>
    <who name="Ben Adam">benjamin.mark.adam</who>
    <bug_when>2023-09-22 11:58:25 -0700</bug_when>
    <thetext>Also running into this problem. Here is an example https://o4zyd0.csb.app ... The app has the styles

#form-fields:not(:has(li)) ul,
#form-fields:not(:has(li)) button {
  display: none;
}

but when the form field is added to the fieldset, the query does not match (however subsequent updates to the dom are fast and work).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1986704</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-10-21 14:24:56 -0700</bug_when>
    <thetext>It would good to write a web-platform-test for this if you have time: https://github.com/web-platform-tests/wpt

That would help us fix it.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>467614</attachid>
            <date>2023-09-08 19:56:02 -0700</date>
            <delta_ts>2023-09-08 19:56:02 -0700</delta_ts>
            <desc>Simple test case</desc>
            <filename>test_case.html</filename>
            <type>text/html</type>
            <size>830</size>
            <attacher>tlf</attacher>
            
              <data encoding="base64">PGh0bWw+DQogIDxzdHlsZT4NCiAgICBzcGFuO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