Skip to content
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

Can't nest facon invocations #11

Open
quat1024 opened this issue Dec 3, 2024 · 0 comments
Open

Can't nest facon invocations #11

quat1024 opened this issue Dec 3, 2024 · 0 comments

Comments

@quat1024
Copy link
Contributor

quat1024 commented Dec 3, 2024

#5 says it allows nestable facon invocations, but it doesn't seem to work :(

This

const foo = f`<span>hello</span>`;
const bar = f`<h1>${foo}</h1>`;
document.body.appendChild(bar);

results in this being written to the document
image
🙁

Still not too familiar with the JS world, but DocumentFragment (the contents of template.content) is not an instance of HTMLElement according to MDN so I think the code as-written is behaving "correctly". Personally I changed instanceof HTMLElement to instanceof Node and it seems to work, but i haven't tested it too well (idk what happens if you try to splice in multiple children, for example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant