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

Changing the maximum size of an element name to 128 #297

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

gungun974
Copy link
Contributor

So this PR is exactly the same thing of my PR #212 except I make the maximum size twice as actual.

Why change again ? Is 32 not long enough ? Well yes and no for me...

In my project I need to create some custom element who represent an administration task form controller.
For this the name should be <admin-create-reservation-controller> since it's represent what the custom element do.
Except this example is 35 longs...

So this is why I remade the same PR as #212.

But now I was wondering ? Why is Templ limit the maximum length of an element ? Web Component don't have any restriction on their name so why ?

@gungun974 gungun974 force-pushed the extra-long-element-name branch from c3f6d23 to 4b13775 Compare November 13, 2023 15:15
@a-h
Copy link
Owner

a-h commented Nov 13, 2023

It's really just there as a backstop to let users know that the document has been parsed, but has a value that they probably weren't expecting.

I figured it would be unexpected to have such a long element name, and it would likely mean a bug.

Setting it to 128 would be fine, I came up with the limit based simply on the list of HTML names.

@gungun974
Copy link
Contributor Author

It's really just there as a backstop to let users know that the document has been parsed, but has a value that they probably weren't expecting.

I figured it would be unexpected to have such a long element name, and it would likely mean a bug.

Setting it to 128 would be fine, I came up with the limit based simply on the list of HTML names.

Hum that a nice touch to prevent some big bug.

I setup the limit up to 128 characters so this problem should never occur again for anyone.

If I made a third PR about complaining I can't write a custom element with 129 characters.

I think you can mock me before rejecting this third PR xD

@gungun974 gungun974 changed the title Changing the maximum size of an element name to 64 Changing the maximum size of an element name to 128 Nov 13, 2023
@a-h a-h merged commit f18e82f into a-h:main Nov 13, 2023
4 checks passed
ross96D pushed a commit to ross96D/templ that referenced this pull request Nov 14, 2023
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