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 16280 - [Templates]: [Non-normative] Clarify the behavior of Node/Element mutation, traversal & serialize/deserialize APIs on <template>
Summary: [Templates]: [Non-normative] Clarify the behavior of Node/Element mutation, t...
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:
: 16788 (view as bug list)
Depends on:
Blocks: 15476
  Show dependency treegraph
 
Reported: 2012-03-08 23:35 UTC by Dimitri Glazkov
Modified: 2012-10-04 20:50 UTC (History)
3 users (show)

See Also:


Attachments

Description Dimitri Glazkov 2012-03-08 23:35:38 UTC
Non-normatively explain this. Also, whether nested template elements get a new document.
Comment 1 Rafael Weinstein 2012-08-16 17:29:32 UTC
[Note: I'm going to make a separate bug for the "does each template get its own browser-context-less document or not" bug]

This bug should resolve the following:

Given a template with parsed contents, e.g.

<body>
  <template>
    <div>Foo</div>
  </template>
</body>

specify the behavior of:

-childNodes
-firstChild
-firstElementChild
-appendChild
-removeChild
-innerHTML (set)
-innerHTML (get)
Comment 2 Rafael Weinstein 2012-08-16 17:37:31 UTC
[editorial]

So my feeling is that the tricky part of this is that given that a template deserializes by lifting elements into its content DF, it stands to reason that the reverse would be true. E.g. It seems desireable to retain the following:



document.documentElement.innerHTML = myMarkupString;
var output = document.documentElement.innerHTML;
assert(output == myMarkupString).

This suggests to me that template.innerHTML should parse the markup using implied context parsing, and
replace its content DF with the resulting DOM.

---

I think that childNodes, appendChild, etc... should not delegate to the content DF. E.g. though would behave much like <script> by simply appending children to the template, but not affecting its content.

Serializing a <template> which both direct children and content would result similarly to <script>. E.g.

<script>var i = 1;</script>

var i = document.getElementById('foo');
var div = i.appendChild(document.createElement('div'));
div.innerHTML = 'bar';
i.innerHTML // var i = 1;<div>bar</div>
Comment 3 Rafael Weinstein 2012-08-16 18:37:16 UTC
*** Bug 16788 has been marked as a duplicate of this bug. ***
Comment 4 Rafael Weinstein 2012-10-04 20:50:10 UTC
this is now effectively covered in the introduction:

http://dvcs.w3.org/hg/webcomponents/rev/69a61698173c