Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dyn Node more usable. #83

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

mobiusklein
Copy link
Contributor

The Node trait currently is the only way to interact with any element in the tree in a type-safe manner via Box<dyn Node>. This PR adds new behaviors to the Node trait and its implementation generators that allow it to:

  1. Determine the kind of DOM node a dyn Node is, though not via the Rust type system.
  2. Read and write attributes of the DOM node in a dispatch-safe manner.
  3. Traverse the children of a dyn Node immutably or mutably.

While it would be possible to do this cleanly, I suspect it'd be difficult to do without breaking things.

@flosse
Copy link
Contributor

flosse commented Sep 16, 2024

@IvanUkhov what do you think about this PR?

src/node/blob.rs Outdated Show resolved Hide resolved
src/node/mod.rs Outdated Show resolved Hide resolved
mobiusklein and others added 2 commits September 26, 2024 18:00
Co-authored-by: Markus Kohlhase <mail@markus-kohlhase.de>
Co-authored-by: Markus Kohlhase <mail@markus-kohlhase.de>
@IvanUkhov IvanUkhov merged commit 6381abe into bodoni:main Sep 27, 2024
0 of 3 checks passed
@IvanUkhov
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants