[Webkit-unassigned] [Bug 261320] New: element.querySelector(":has(:scope *)") should never match

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 8 00:03:56 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=261320

            Bug ID: 261320
           Summary: element.querySelector(":has(:scope *)") should never
                    match
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: heycam at apple.com

In CSSSelectorParser::consumeRelativeScopeSelector we sometimes insert a PseudoClassType::RelativeScope pseudo-class at the front of the selector argument of a :has().  This is what ensures that the matching of the selector argument does not break out of the :has scope.

But we only do this if (a) we don't already mention :scope in the selector argument, or (b) the :has() scope combinator is not DescendantSpace.  But we do need this synthesized RelativeScope pseudo-class, otherwise this will alert true when it shouldn't:

<div id=x><span></span></div>
<script>
alert(x.matches(":has(:scope span)"));
</div>

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230908/912db94e/attachment-0001.htm>


More information about the webkit-unassigned mailing list