Skip to content

Conversation

geoffreygarrett
Copy link
Contributor

@geoffreygarrett geoffreygarrett commented Dec 22, 2024

What's Changed

  • Added AnyNodeRef for type-erased node references
  • Introduced ToAnyNodeRef trait for converting between typed and untyped node refs
  • Implemented conversion for HTML, SVG, and Math node types
  • Also reorganized the workspace & shared versioning

Why

Enables more flexible handling of DOM node references across different element types. Specifically It's needed for updating this implementation RustForWeb/radix#26 for 0.7.X

Examples

let div_ref: NodeRef<html::Div> = NodeRef::new();
let any_ref = div_ref.to_any(); // Type-erased conversion

Working towards:

pub fn compose_refs(refs: impl IntoIterator<Item = AnyNodeRef>) -> AnyNodeRef {
    let composed_ref = AnyNodeRef::new();
    let refs: Vec<_> = refs.into_iter().collect();
    // ...
}

My Checklist

  • Added new functionality
  • Updated tests
  • Ran all tests
  • Maintained existing behavior

Would you like me to modify this further @DanielleHuisman?

geoffreygarrett added 4 commits December 22, 2024 12:53
…dling

- Introduced the  trait to enable conversion of typed s to

- Facilitates generic operations on various node references across HTML, SVG, and Math node types

- Added comprehensive tests to ensure the functionality and reliability of the new trait

- Updated  to reflect version bump to 0.0.4
@DanielleHuisman
Copy link
Member

DanielleHuisman commented Dec 31, 2024

I haven't had much time to review this during the holidays. Do you still want me to look at it?

@geoffreygarrett
Copy link
Contributor Author

@DanielleHuisman see #13

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants