kuchiki-rs / kuchiki

(朽木) HTML/XML tree manipulation library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for the :scope pseudo-class

simmons opened this issue · comments

It would be useful if :scope could be used to anchor selection to the root of the inclusive-descendant tree. For example, in the following document, div_b.select(":scope > div") should return the div.c element (as it does in Javascript), but instead returns nothing because the document root is being used as the selection scope.

<html>
    <body>
        <div class="a">
            <div class="b">
                <div class="c">
                </div>
            </div>
        </div>
    </body>
</html>

From a brief glance at the selectors crate, it appears that :scope is supported, but the MatchingContext::scope_element field must be directly set.

I will soon archive this repository and make it read-only, so this issue will not be addressed: https://github.com/kuchiki-rs/kuchiki#archived