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

Discussion: What patterns should be allowed for attributes and properties. #199

Open
theengineear opened this issue Nov 8, 2024 · 0 comments

Comments

@theengineear
Copy link
Collaborator

Attributes

// accepted
html`<div foo="${bar}"></div>`
html`<div fOo="${bar}"></div>`
html`<div f-o-o="${bar}"></div>`
html`<div foo-="${bar}"></div>`
html`<div f00="${bar}"></div>`

// rejected
html`<div 1foo="${bar}"></div>`
html`<div f_o_o="${bar}"></div>`
html`<div Foo="${bar}"></div>`
html`<div -foo="${bar}"></div>`
html`<div _foo="${bar}"></div>`

Properties

// accepted
html`<div .foo="${bar}"></div>`
html`<div .fOo="${bar}"></div>`
html`<div .f_o_o="${bar}"></div>`
html`<div .foo_="${bar}"></div>`
html`<div .f00="${bar}"></div>`

// rejected
html`<div .1foo="${bar}"></div>`
html`<div .f-o-o="${bar}"></div>`
html`<div .Foo="${bar}"></div>`
html`<div .-foo="${bar}"></div>`
html`<div ._foo="${bar}"></div>`

Context

I recently went to port some code that was using a property like _internal, and that cannot be bound via ._internal="${whatever}". At first, I thought it would be better to allow it… but then I thought… it’s really not internal, it’s on the public interface. I am waffling a bit on how restrictive / flexible to be here.

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