Without turning it on yet, of course. The reason why I didn't use the general PseudoElement mechanism is because this pseudo is a bit of its own thing, and I found easier to make ::selectors know about it (because you need to jump to the assigned slot) than the other way around. Also, we need to support ::slotted(..)::before and such, and supporting multiple pseudo-elements like that breaks some other invariants around the SelectorMap, and fixing those would require special-casing slotted a lot more in other parts of the code. Let me know if you think otherwise. I also don't like much the boolean tuple return value, but I plan to do some cleanup in the area in a bit, so it should go away soon, I'd hope. |
||
---|---|---|
.. | ||
attr.rs | ||
bloom.rs | ||
build.rs | ||
builder.rs | ||
Cargo.toml | ||
context.rs | ||
gecko_like_types.rs | ||
lib.rs | ||
matching.rs | ||
nth_index_cache.rs | ||
parser.rs | ||
README.md | ||
sink.rs | ||
size_of_tests.rs | ||
tree.rs | ||
visitor.rs |
rust-selectors
CSS Selectors library for Rust. Includes parsing and serilization of selectors, as well as matching against a generic tree of elements. Pseudo-elements and most pseudo-classes are generic as well.
Warning: breaking changes are made to this library fairly frequently (13 times in 2016, for example). However you can use this crate without updating it that often, old versions stay available on crates.io and Cargo will only automatically update to versions that are numbered as compatible.
To see how to use this library with your own tree representation,
see Kuchiki’s src/select.rs
.
(Note however that Kuchiki is not always up to date with the latest rust-selectors version,
so that code may need to be tweaked.)
If you don’t already have a tree data structure,
consider using Kuchiki itself.