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

Add failing test for declarative shadow-dom #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Feb 1, 2024

@ef4
Copy link
Collaborator

ef4 commented Feb 1, 2024

This is an intentional limitation of the proposed content-tag format. For it to be agnostic about the interior language, it can't allow unescaped </template> inside the content tag. We could devise an escaping mechanism.

@NullVoxPopuli
Copy link
Contributor Author

intentional limitation

I don't believe this, it doesn't make sense?

At least, with how I understand your words, it forbids folks from ever using The Platform for stuff like this: https://developer.chrome.com/docs/css-ui/declarative-shadow-dom (or whatever else can be done with <template>)

For it to be agnostic about the interior language, it can't allow unescaped inside the content tag.

This seems reasonable to me. We shouldn't be allowing any unescaped tag anyway.
I don't know what this'll mean for tools like Glint, where they want error-tolerance 🤷

// https://developer.chrome.com/docs/css-ui/declarative-shadow-dom
let input = `
<template>
<template shadowrootmode="open">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<template> is only useful with the shadowrootmode attribute, otherwise <template> isn't rendered at all

image

@ef4
Copy link
Collaborator

ef4 commented Feb 20, 2024

I don't believe this, it doesn't make sense?

Read more carefully, I said it's not allowed without escaping. For the same reason that a single-quoted Javascript string literal has an intentional limitation that you can't use unescaped single quotes in them.

The point here is that content-tag is supposed to work regardless of the interior language. For that to be possible, the outside language (content-tag itself) needs to claim some delimiter to mark the end, and if the interior languages wants to use that delimiter it needs to be escaped.

@NullVoxPopuli
Copy link
Contributor Author

do we have a means to escape?

@ef4
Copy link
Collaborator

ef4 commented Feb 21, 2024 via email

@NullVoxPopuli
Copy link
Contributor Author

Recapping from the spec meeting, and "having had time to sleep on it", I think supporting a

<glimmer> ... </glimmer> alternate is my preference for "just paste your HTML and have it work".

that would be kind of annoying to switch <template> to <glimmer>, so i think we should support both for a time. It's compiled away, and only really matters for folks not using content-tag for tooling 😅
(Currently, that's just Glint and template-lint, afaik))

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

Successfully merging this pull request may close these issues.

2 participants