-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render across <template>
element boundaries
#72
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@seanpdoyle the test runner is being a bit wonky, but I pulled locally (and rebased with Would you kindly rebase this with |
@keithamus I faced a similar set of failures locally. I was hoping that CI would execute and give me more information. What steps might I be missing locally to run the suite? |
If you rebase you might find it fixed. I had the issues locally and simply updated all dependencies which got tests working again for me, so I assumed we had a bit of dependency rot. |
e14ddf4
to
a6895d9
Compare
@keithamus thank you for the guidance. I was able to successfully pass the suite locally. Could you enable CI? |
Take, for example, a `<template>` that nests other `<template>` elements: ```html <template> <template> <div>{{x}}</div> </template> </template> <script type="module"> import { TemplateInstance } from "@github/template-parts" const template = document.querySelector("template") const instance = new TemplateInstance(template, { x: "Hello world" }) document.body.append(instance) </script> ``` Prior to this change, the inner `<template>` element (and its child `<div>`) are unchanged and still render `{{x}}` as a text node. This change aims to bring support for templating across `<template>` boundaries. To achieve this behavior, add explicit [HTMLTemplateElement][] handling to the tree walking. When handling a `<template>` element, walk its content `DocumentFragment`, treating variables in the same as way as the outer `<template>` element. [HTMLTemplateElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement
a6895d9
to
a27cd0b
Compare
@keithamus thank you for merging this and including it as part of the v0.6.4 release! I'm trying to install that release from npm, but the latest available release is v0.5.4. Is that deliberate? If not, are you able to release v0.6.4 to npm? |
Take, for example, a
<template>
that nests other<template>
elements:Prior to this change, the inner
<template>
element (and its child<div>
) are unchanged and still render{{x}}
as a text node.This change aims to bring support for templating across
<template>
boundaries. To achieve this behavior, add explicit HTMLTemplateElement handling to the tree walking. When handling a<template>
element, walk its contentDocumentFragment
, treating variables in the same as way as the outer<template>
element.Without this support, explicit iteration and replacement is necessary for each boundary: