<?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>244708</bug_id>
          
          <creation_ts>2022-09-02 02:22:35 -0700</creation_ts>
          <short_desc>:has() selector does not accept forgiving selector list</short_desc>
          <delta_ts>2023-10-21 14:28:06 -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 Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=249914</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Rune Lillesveen">rune.lillesveen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bramus</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>m.goleb+bugzilla</cc>
    
    <cc>ntim</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1895734</commentid>
    <comment_count>0</comment_count>
    <who name="Rune Lillesveen">rune.lillesveen</who>
    <bug_when>2022-09-02 02:22:35 -0700</bug_when>
    <thetext>The :has() selector takes a &lt;forgiving-relative-selector-list&gt;[1], but a rule like :has(:unknown) {} is fully dropped in WebKit.

There is a failing wpt test in [2].

[1] https://drafts.csswg.org/selectors/#typedef-forgiving-relative-selector-list
[2] https://wpt.fyi/results/css/selectors/has-error-recovery.html?label=experimental&amp;label=master&amp;aligned</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895746</commentid>
    <comment_count>1</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-09-02 03:48:57 -0700</bug_when>
    <thetext>Note that implementing `:has` according to the spec breaks `:has` usage with jQuery for almost all versions in use in the wild: https://github.com/jquery/jquery/issues/5098</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895765</commentid>
    <comment_count>2</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-09-02 05:26:15 -0700</bug_when>
    <thetext>We currently do use forgiving parsing for :has() but still fail the selector if the selector lists ends up empty. That is

:has(:foo, bar) { }

is valid and parses to

:has(bar) { }

but 

:has(:foo) is invalid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895766</commentid>
    <comment_count>3</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-09-02 05:26:34 -0700</bug_when>
    <thetext>I suppose this saves us from the jQuery problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1895798</commentid>
    <comment_count>4</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-09-02 10:02:28 -0700</bug_when>
    <thetext>See https://github.com/w3c/csswg-drafts/issues/7676#issuecomment-1235724730

The WebKit behavior still breaks some jQuery selectors. True, it doesn&apos;t break:
```
div:has(span:contains(&apos;Item&apos;))
```
but it still breaks:
```
div:has(div, span:contains(&apos;Item&apos;))
```
Maybe that latter kind of selectors is not used as often in the wild.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1896325</commentid>
    <comment_count>5</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-09-05 05:51:59 -0700</bug_when>
    <thetext>A full fix for future jQuery versions requires implementing bug 244808 so please have a look at this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897196</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-09 02:23:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/99736653&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898725</commentid>
    <comment_count>7</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2022-09-15 09:35:06 -0700</bug_when>
    <thetext>Note that there are discussions about this behavior being beneficial currently, as it doesn&apos;t break jQuery.

See the discussion in https://github.com/w3c/csswg-drafts/issues/7676</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898727</commentid>
    <comment_count>8</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2022-09-15 09:36:50 -0700</bug_when>
    <thetext>oops hit return too early. 
Chrome 106 copies the behavior of Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1986705</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-10-21 14:28:06 -0700</bug_when>
    <thetext>No longer valid with bug 249914.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>