Skip to content

Support for :has() selector #169

@124C41p

Description

@124C41p

Hi, do you plan to support the :has() selector? To my understanding, this css keyword is needed for selecting objects based on the parent of another known object.

Consider the following example:

<div>
    <div id="foo">
        Hi There!
    </div>
</div>
<ul>
    <li>first</li>
    <li>second</li>
    <li>third</li>
</ul>

In order to select the second list item, I would like to use the following selector:

let selector = Selector::parse("div:has(div#foo) + ul > li:nth-child(2)").unwrap();

This line however panics as of scraper version 0.18.1.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions