-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Should webc:nokeep be required on templates that use a single render-function #135
Comments
you know what, I think this is a bug. We should ignore host component names outside of |
One thought that occurs to me is what should happen in the case where the render function returns HTML and CSS/JS? test-render-fn.webc <script webc:type="js">
`<p>hello</p>
<style>
p { color: tomato }
</style>`;
</script> I would expect that in this case the custom element remains in the output. But this also seems like it’s making evaluation of a template like this very difficult for WebC (and also perhaps for developers to understand). |
Just for extra clarity I don’t think it’s valid in any scenarios to output custom element names outside of a So |
So let me make sure I understand: when using a WebC template in the head by doing something like this: <head>
<meta webc:is="og-meta" />
</head> Under no circumstances would you permit I think that’s handy, but the example I gave above is actually happening in the Are you proposing that the behavior of That seems pretty reasonable to me. Ensuring that WebC doesn’t knowingly generate invalid HTML seems fine, I just want to be sure I understand what you’re saying. 😅 |
Yes.
Independent of the other caveat mentioned above I agree with your expected output for |
Filed that ancillary issue here: #137 |
Shipping with 0.10.0 |
I don’t know if this should be considered a bug or not. It caught me by surprise, but I can understand why it happens, so maybe it’s just an education problem…
Using a single render function in a template to generate your HTML—instead of just a plain HTML template—requires the use of
webc:nokeep
to remove the custom element from the output.Example
test-html-component.webc
test-render-fn.webc
index.webc
Output
Expected (?) Output
Part of me thinks that since the render function is just generating HTML, it should be treated like an HTML-only template and the custom element should be automatically removed (this was my assumption at the outset). Especially since some logic requires a render function—e.g. loops and if-else blocks—so conceivably, a person would have to use a render function for an HTML-only component.
On the other hand, you could argue that the presence of a
<script>
tag in the template means it is not an HTML-only component, and if you want to automatically remove the custom element, you should just addwebc:root=override
to the<script>
.The text was updated successfully, but these errors were encountered: