Skip to content

Talk: A Treeless CSS Selector #51

@zacharyvmm

Description

@zacharyvmm

https://github.com/zacharyvmm/1go

While still a work in progress, this library already outperforms comparable low-level libraries and Python bindings.
You can view the benchmarks here: https://github.com/zacharyvmm/1go/tree/main/benches.

I'm particularly excited about the query tree feature.
Since this implementation doesn't build a traditional tree structure, it must consolidate multiple queries into a single.

let html = "...";

let query = Query::first("div p.class", Save::none())
    .then(|p| [
         p.first("span", Save::none()),
         p.all("a", Save::none())
    ]).build();
// "div p.class" -> "span"
//               -> "a"

let map = parse(html, &[query]);

Equivalent to:

const main = document.querySelector('main');

const first_span = main.querySelector('span');
const anchors = main.querySelectorAll('a');

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions