#xpath #css #css-selectors #selector

cssifier

Simple crate to convert XPath selectors to CSS selectors

4 releases

0.1.3 Mar 21, 2021
0.1.2 Mar 14, 2021
0.1.1 Mar 8, 2021
0.1.0 Mar 8, 2021

#2118 in Parser implementations

26 downloads per month

GPL-3.0-or-later

7KB
85 lines

CSSIFIER_RS

Simple crate to convert XPath selectors to CSS selectors

based on cssify but rewrited in Rust (RiiR FTW).

dependencies:

Usage

The usage is simple:

cssifier("//a/b")
// Some("a b")

cssifier("//a/b[@id='hello']")
// Some(a b#hello)

cssifier("//a/b[contains(text(), 'hello')]")
// Some(a b:contains(hello))

Known issues

  • bug in 'contains' condition
  • invalid XPath return empty String
  • Compatible with WASM

Contributors are welcome :).

Dependencies

~2.2–3MB
~53K SLoC