glimmerjs / glimmer-vm

MIT License
1.13k stars 191 forks source link

allow uppercase elements in strict mode #1650

Closed patricklx closed 2 weeks ago

patricklx commented 2 weeks ago

this would allow to have web components elements with upper case style.

right below the code it actually says In strict mode, values are always elements unless they are in scope so lets make it that way. This would make it possible for non-browser env to use upper case elements, like ember-native. Maybe it could be configurable?

NullVoxPopuli commented 2 weeks ago

Have to revert, apologies. This accidentally blocks <Style> from becoming a keyword -- something we are entertaining the idea of here: https://github.com/emberjs/rfcs/pull/1037

@patricklx -- can you expand on why you wanted this?

It's possible my assumptions about this removal don't align with your motivations

wycats commented 2 weeks ago

@patricklx I'd be very interested to learn how you encountered this? What were you trying to do?

patricklx commented 2 weeks ago

Just a web component.

<template>
  Hello, Glimmer!
  <MyWebComponent />
</template>

https://share.glimdown.com/jnNZc45SRtWdT93u7GXt5Q

Edit: just noticed that web components must start with lower case. I thought it was limited only by glimmer... But still, for ember-native it would be useful

This affects https://github.com/ember-native/ember-native Where all nativescript components are dom elements. By default nativescript writes them with upper case. I wanted to have it work the same . And it strict mode everything that is not in scope could just be rendered as html element. Why should randomElementName work, but not RandomElementName? In strict mode. gjs.

I'm not sure how this would block the Style keyword. It would need code changes in glimmer anyway? A element keyword looks like a new concept. Could it not be something importable? (Well, maybe this part is for the other discussion) If it is uppercase then the usage of it is currently blocked :D, if it doesn't have an import.