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

Feature request: Disallow tags in invalid places #1

Open
DannyJJK opened this issue Dec 3, 2019 · 1 comment
Open

Feature request: Disallow tags in invalid places #1

DannyJJK opened this issue Dec 3, 2019 · 1 comment

Comments

@DannyJJK
Copy link

DannyJJK commented Dec 3, 2019

Hi,

I was able to put a h1 inside a head tag, it would be really good if it could avoid things like this.

html := Html5_(
	Head_(
		H1_(Text("Test")),
	),
	Body_(
		H1_(Text("Test")),
	),
)

Here, the H1 inside the Head tag should make a compilation error, instead it renders the h1 inside the head tag where it's not allowed

@julvo
Copy link
Owner

julvo commented Dec 4, 2019

Hey DannyJJK - I really like the idea. Similarly, setting invalid attributes on elements should raise compile errors. It seems like the 2 steps necessary to add this feature would be 1) figuring out a nice way to make reflect valid parent-child (or element-attribute) combinations in the type system and 2) get a complete specification of these valid combinations.

I'll keep this request in mind, but won't promise it will be added anytime soon. If you have any suggestions for one of the two steps above, happy to chat them through

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

2 participants