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 23795 - Template elements with the same ownerDocument should share a single contents ownerDocument
Summary: Template elements with the same ownerDocument should share a single contents ...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-11 21:20 UTC by Adam Klein
Modified: 2013-11-12 22:14 UTC (History)
4 users (show)

See Also:


Attachments

Description Adam Klein 2013-11-11 21:20:51 UTC
The algorithm for creating the content DocumentFragment of templates (http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#template-contents) says in step 2.1 to always create a new Document. But this is not what Gecko or Blink do. The following code returns true on both those engines:

t1 = document.createElement('template');
t2 = document.createElement('template');
t.content.ownerDocument === t2.content.ownerDocument
Comment 1 William Chen 2013-11-11 21:28:16 UTC
It seems like the concept of "template contents owner" didn't get carried over from the old spec.

https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#definitions
Comment 2 Rafael Weinstein 2013-11-12 20:26:51 UTC
Yep. I probably missed this when reviewin Hixie's changes from the stand-alone spec. Apologies. Adam is correct: The original spec (plus WebKit/Blink/Gecko) intentionally avoids creating tons of documents to host template contents.

The stand-along spec used the term "template contents owner doc":

https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#dfn-template-contents-owner

These steps attempt to create the situation where there is at most one owning document per displayed document which contains templates.
Comment 3 Ian 'Hixie' Hickson 2013-11-12 21:36:46 UTC
Huh, that totally went over my head. I didn't realise the implications of how that was defined. My bad. Fixed.
Comment 4 contributor 2013-11-12 21:36:57 UTC
Checked in as WHATWG revision r8270.
Check-in comment: Share the ownerDocument of template contents amongst the templates of a document.
http://html5.org/tools/web-apps-tracker?from=8269&to=8270
Comment 5 Rafael Weinstein 2013-11-12 22:14:29 UTC
lgtm. thanks, hixie.