kuchiki-rs / kuchiki

(朽木) HTML/XML tree manipulation library for Rust
MIT License
470 stars 54 forks source link

Put selector methods behind a feature #92

Closed zecakeh closed 2 years ago

zecakeh commented 2 years ago

Currently this crate pulls in cssparser and selectors to add the possibility to lookup nodes with CSS selectors.

I'm working on a project that needs to do some HTML manipulation to sanitize the input, but we don't need to use CSS selectors so we would like to avoid pulling crates we don't need.

Would it make sense for this project to move all the selector features behind a Cargo feature, to reduce the number of dependencies for projects that don't need them?

SimonSapin commented 2 years ago

This project started as a proof of concept of how to do plumbing to use selectors together with html5ever. If you remove that there’s not much left. Would using html5ever with your own tree data structure work for you? Plus, that choice of data structure is full of trade-offs so you’d get to pick a design that works best for you. (See here and here for an example that doesn’t use Rc.)

zecakeh commented 2 years ago

Sure it would be a solution, thanks for the examples.

The idea was that there's not a lot of DOM manipulation crates around, so we might not be the only project that would be interested by that.

I'm gonna close this then as it seems out of scope for this crate.