<?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>234733</bug_id>
          
          <creation_ts>2021-12-28 14:42:07 -0800</creation_ts>
          <short_desc>[:has() pseudo-class] Not matching elements it should</short_desc>
          <delta_ts>2022-01-03 09:04:10 -0800</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 Technology Preview</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 11</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>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brandon McConnell">brandon</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>koivisto</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1827128</commentid>
    <comment_count>0</comment_count>
    <who name="Brandon McConnell">brandon</who>
    <bug_when>2021-12-28 14:42:07 -0800</bug_when>
    <thetext>In my testing of the `:has()` pseudo-class, I discovered a few cases where `:has()` is not matching elements that it should.

Check example #&apos;s 9 and 10 at this example URL (https://codepen.io/brandonmcconnell/pen/a93e58403165e721481e7fc4fe3fb676?editors=1100):
 * Example 9
 * Example 10

In both of those examples, you will see under &quot;Should be&quot; the squares which should be filled (by matching the selector under &quot;Implementation&quot;) which are also not being filled in the actual render, under &quot;Actually rendered&quot;.

Example 9 selector: `y:has(+ x, + * + x, + * + * + x)`
Example 10 selector: `y:has(~ * + * + x)`</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1827714</commentid>
    <comment_count>1</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-01-03 07:04:36 -0800</bug_when>
    <thetext>There is a small bug in the test case. There is a comma missing after

&amp;_09 y:has(+ x, + * + x, + * + * + x)

which makes rules 8 and 9 invalid. With that fixed everything seems to work at least in trunk.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1827715</commentid>
    <comment_count>2</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-01-03 07:05:18 -0800</bug_when>
    <thetext>rules 9 and 10 I mean.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1827718</commentid>
    <comment_count>3</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-01-03 07:13:39 -0800</bug_when>
    <thetext>Neat test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1827768</commentid>
    <comment_count>4</comment_count>
    <who name="Brandon McConnell">brandon</who>
    <bug_when>2022-01-03 09:04:10 -0800</bug_when>
    <thetext>Ah yes, where would be without careless bugs like this 🤦🏻‍♂️

Thank you for finding that. Glad there wasn&apos;t an additional bug to resolve. Best case scenario. It appears most remaining bugs surrounding :has() will be resolved once the fix on Bug #234531 (https://bugs.webkit.org/show_bug.cgi?id=234531) is pushed.

Thanks again!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>