diff --git a/src/TemplateBinding.js b/src/TemplateBinding.js index b148930..3ff2bf3 100644 --- a/src/TemplateBinding.js +++ b/src/TemplateBinding.js @@ -268,7 +268,8 @@ } // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#dfn-template-contents-owner - function getTemplateContentsOwner(doc) { + function getOrCreateTemplateContentsOwner(template) { + var doc = template.ownerDocument if (!doc.defaultView) return doc; var d = doc.templateContentsOwner_; @@ -284,6 +285,20 @@ return d; } + function getTemplateStagingDocument(template) { + if (!template.stagingDocument_) { + var owner = template.content.ownerDocument; + if (!owner.stagingDocument_) { + owner.stagingDocument_ = owner.implementation.createHTMLDocument(''); + console.log('created'); + } + + template.stagingDocument_ = owner.stagingDocument_; + } + + return template.stagingDocument_; + } + // For non-template browsers, the parser will disallow