[Bug 23839] [Custom]: Template document should not share registry with its document

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23839

Adam Klein <adamk@chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adamk@chromium.org

--- Comment #5 from Adam Klein <adamk@chromium.org> ---
As currently specced in HTML, <template> doesn't always create a new Document
for its content fragment; if its ownerDocument lacks a defaultView, it assumes
it's fine to re-use that one. This handles the case:

<template>
  <template>
    ...

so that each <template> doesn't cause the creation of a new Document. However,
with this spec change, it's now possible to see different Custom Element
behavior in a <template> that happens to be in a Document created via
document.implementation.createHTMLDocument(), since:

doc = document.implementation.createHTMLDocument('title')
template = doc.createElement('template')
template.ownerDocument === template.content.ownerDocument

In such documents, custom elements inside templates will be "alive". The right
fix is likely to tighten <template>'s requirements for when it will re-use its
ownerDocument, i.e., only re-use ownerDocument if it's actually the content
owner document of another <template>. This requires tagging template content
documents upon creation.

I intend to file the above against the HTML spec, but I wanted to have an
explanation written down here, too, since it was this bug report that requires
the change to <template>'s behavior.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 20 November 2013 22:50:35 UTC