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

Add info about interpolating reference-equal nodes #49

Closed
wants to merge 1 commit into from

Conversation

lionel-rowe
Copy link

No description provided.

@mootari
Copy link
Member

mootari commented Feb 6, 2023

The accompanying Observable notebook is a better place for these examples. I'll share your feedback with the team to discuss how we can improve the documentation there.

@mootari mootari closed this Feb 6, 2023
@mbostock
Copy link
Member

mbostock commented Feb 6, 2023

FWIW I don’t see any harm in including this additional clarification in the README (as well as the notebook).

However, I do think the language should be generalized somewhat, since this isn’t just about interpolating reference-equal nodes; it’s also about interpolating a node that already exists (elsewhere) in the DOM, and knowing that HTL will remove that node from its existing location as a side-effect of interpolating it into its new location. And it’s also useful to know that the node that you interpolate is the same node that ends up in the DOM, say if you want to do things to that node subsequently (e.g., add or remove event listeners, or mutate a previously-inteprolated node’s contents).

@lionel-rowe
Copy link
Author

FWIW I don’t see any harm in including this additional clarification in the README (as well as the notebook).

However, I do think the language should be generalized somewhat, since this isn’t just about interpolating reference-equal nodes; it’s also about interpolating a node that already exists (elsewhere) in the DOM, and knowing that HTL will remove that node from its existing location as a side-effect of interpolating it into its new location. And it’s also useful to know that the node that you interpolate is the same node that ends up in the DOM, say if you want to do things to that node subsequently (e.g., add or remove event listeners, or mutate a previously-inteprolated node’s contents).

Sure, makes sense — I'll leave the exact wording up to you folks rather than making another PR.

While you're here, TS definitions and allowing setting the window object would both be super useful too 😉

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.

3 participants