Skip to content

Replace RcDom with a tree Citry owns #613

Open

Description

@JuroOravec

citry_html_transform builds its HTML trees with markup5ever_rcdom. That crate is compiled into the citry_core wheel, but html5ever's maintainers keep it only for their own tests. Its crates.io description reads "Basic, unsupported DOM structure for use by tests in html5ever/xml5ever". We shouldn't depend on it in code we ship.

html5ever's public way to build a tree is its TreeSink trait, so Citry can own a small tree that implements it.

What we want

  1. Add a tree type in citry_html_transform that implements TreeSink. It keeps nodes in one Vec and does not scan a parent's children to place a node.
  2. Move output_scanner.rs, static_html.rs, hydration_structure.rs and html_limits.rs to it.
  3. Keep markup5ever_rcdom as a dev-dependency only, as the reference that the new tree is compared against in tests.

Done when

  • markup5ever_rcdom is gone from [dependencies].
  • A test parses a varied set of HTML with both trees and finds them equal.
  • The output checks and the hydration check give the same results as before.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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