dom
dom copied to clipboard
Provide a "deep clone" shorthand
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.
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.