WICG / webcomponents

Web Components specifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[dom-parts] cloneWithParts / cloneTree

rniwa opened this issue · comments

We need an API to clone parts with tree.

Current proposal:
https://github.com/WICG/webcomponents/blob/gh-pages/proposals/DOM-Parts.md#cloning-parts

partial interface Node {
    NodeWithParts cloneTree(optional CloneOptions options = {});
};

dictionary CloneOptions {
    boolean deep = true;
    Document? document;
    PartGroup? partGroup;
};

dictionary NodeWithParts {
    Node node;
    PartGroup? partGroup;
};

What happens to the current values of DOM parts? Do we allow DOM parts to have some non-initial values and do we clone those values as well? If so, what do we do with PropertyPart / CustomPart?

I would expect parts to be deep cloned just like elements. If an attribute part reset back to empty string, but the DOM is showing some value for that attribute, that would be strange