W3C home > Mailing lists > Public > public-webapps-bugzilla@w3.org > August 2012

[Bug 18672] New: [Templates]: Define the behavior of cloneNode(deep) on template elements

From: <bugzilla@jessica.w3.org>
Date: Fri, 24 Aug 2012 00:09:38 +0000
To: public-webapps-bugzilla@w3.org
Message-ID: <bug-18672-2532@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=18672

           Summary: [Templates]: Define the behavior of cloneNode(deep) on
                    template elements
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
        AssignedTo: dglazkov@chromium.org
        ReportedBy: rafaelw@chromium.org
         QAContact: public-webapps-bugzilla@w3.org
            Blocks: 15476


template == <template><div>Foo</div></template>

clone = template.cloneNode(true);

options for clone.content:

1) Empty document fragment; // new empty document fragment
2) template.content.cloneNode(deep);  // clone of contents
3) template.content; // share the original's content (content is a reference to
the same document fragment).

Given that one likely use of <template> is templating libraries, and one
motivator for supporting nested <template>s is nested iteration -- I'm
concerned that option (2) would be very wasteful of memory, but provide no
benefit for the use case (in fact many developers may not even think about the
behavior, and woudn't notice a difference between (2) & (3).

I'll put a stake in the ground and claim that the right behavior is (3) because
it makes the naive thing conservative WRT memory and isn't obviously bad
behavior. (2) can still be achieved with more work.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Friday, 24 August 2012 00:09:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 August 2012 00:09:39 GMT