Identifiers vs. strings
matthewp opened this issue · comments
Corset treats identifiers and strings as interchangeable. The only difference is what characters are allowed; identifiers only allow [a-zA-Z]
(note this is probably not to CSS spec and should be fixed).
The use case here is aesthetics and the belief that there wouldn't be builtin identifiers in Corset.
button {
event: click var(--increment);
}
vs.
button {
event: "click" var(--increment);
}
However, @propjockey provided a reason for why we might want builtin identifiers. This would be nice:
.profile:not(.editing) {
text: initial;
}
I think there's a choice here of one of these:
- Force using strings where identifiers are used now.
- Maybe this would be more intuitive anyways?
- Have reserved words like
initial
but otherwise allow identifiers as strings.- Hard to predict ahead of time what we need to reserve.
- Keep identifiers as strings and use functions for things like initial.
initial()
.- Might be unexpected coming from CSS.
- Allow identifiers as strings only in certain properties. For example could we allow them as the event name, without allowing them generally?
This is no longer necessary. I discovered that CSS itself has <custom-ident>
(https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident) and it is more prevalent than I realized. That means that special identifiers for things like initial
are ok; you can always use a string if you want the string value.