Skip to content

Improve ergonomics by allowing to use a string input for fragment selections #27

Closed
@svenstaro

Description

@svenstaro

The intermediate parsing of the Selector itself is a bit annoying. I think it would be neat if it were part of the select().

Current:

let fragment = Html::parse_fragment(html);
let selector = Selector::parse("li").unwrap();

for element in fragment.select(&selector) {}

Proposed a):

let fragment = Html::parse_fragment(html);
for element in fragment.select("li".into()?) {}

Proposed b):

let fragment = Html::parse_fragment(html);
for element in fragment.select("li")? {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions