This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16277 - [Templates]: Specify what happens on template.cloneNode
Summary: [Templates]: Specify what happens on template.cloneNode
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 15476
  Show dependency treegraph
 
Reported: 2012-03-08 23:33 UTC by Dimitri Glazkov
Modified: 2012-12-05 23:52 UTC (History)
2 users (show)

See Also:


Attachments

Description Dimitri Glazkov 2012-03-08 23:33:00 UTC
Clone node to recursively clone the template contents.
Comment 1 Dimitri Glazkov 2012-03-09 18:25:56 UTC
http://dvcs.w3.org/hg/webcomponents/rev/b2709fa45d1b
Comment 2 Rafael Weinstein 2012-12-05 04:51:46 UTC
Re-opening: no one is happy with cloneNode ignoring content and allowing content to be read/write.

More commentary below
Comment 3 Rafael Weinstein 2012-12-05 05:02:01 UTC
My concern about cloneNode(deep) also cloning content was a worry about excessive memory use in the case of recursive templates. My idea was that content wouldn't be cloned, but it was settable, so sharing of content as well as cloning were all possible via script, but the default was most conservative.

Because serialization walks into the content, the problem with allowing content to be settable is that it creates the situation where disallowing hierarchy cycles becomes complicated (a single DocumentFragment can now have multiple template "hosts" and the isDescendant becomes hairy).

After long discussions with Dimitri and Adam, I am convinced that

a) cloneNode(deep) making a "full" copy of the template and its content is a necessary use case and is most consistent with the current expectations of cloneNode

b) logically, an "instantiate" operation is entirely possible both via script and later to be added to the template spec, if necessary. "instantiate" would "share" content, but not directly, it would create a reference to the "source" template. Serialization would only traverse through content, not "ref" and thus cycle prevention would be no worse.

Thus, I plan to return to Dimitri's original spec in this regard, by making content read only and having cloneNode clone contents as well as the node.
Comment 4 Rafael Weinstein 2012-12-05 23:52:51 UTC
http://dvcs.w3.org/hg/webcomponents/rev/96d3865c980d