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

Provide a "deep clone" shorthand #1220

Open
marcoscaceres opened this issue Aug 20, 2023 · 1 comment
Open

Provide a "deep clone" shorthand #1220

marcoscaceres opened this issue Aug 20, 2023 · 1 comment
Labels
clarification Standard could be clearer

Comments

@marcoscaceres
Copy link
Member

The "with the clone children flag set to true" is kinda clunky in prose... it would be amazing to have "deeply clone" shorthand that does the same thing.

For example, instead of:

Let clone be a clone of someElementOrFragment, with the clone children flag set to true.

Nicer:

Let clone be a deep clone of someElementOrFragment.

@annevk
Copy link
Member

annevk commented Aug 25, 2023

Looking at https://dontcallmedom.github.io/webdex/c.html#clone%20a%20node%40%40dom%25%25dfn that doesn't really seem worth it. Perhaps once there are more callers?

We should modernize the algorithm though as per https://infra.spec.whatwg.org/#algorithm-params. Probably the document argument should be an optional named argument and s/clone children flag/deep/ can just be an optional boolean. It's kinda annoying that for consistency it would have to default to false. Perhaps we could consider flipping that, but not sure it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

2 participants