tipsy / j2html

Java to HTML generator. Enjoy typesafe HTML generation.
https://j2html.com/
Apache License 2.0
765 stars 136 forks source link

Remove manual HtmlTag class #185

Closed obecker closed 3 years ago

obecker commented 3 years ago

I would propose to remove the specialized HtmlTag class (and also HeadTag and BodyTag) and just let them be generated like other ContainerTag classes.

Summarized: the above disadvantages outweight the (small and questionable) advantage of enforcing a correct content model for the html element , so we should replace the manual version of this class with the corresponding generated version.

sembler commented 3 years ago

I like the idea, and you've listed good reasons to do this. Will this cause any breaking changes for users, or is this returning it to the state it was in at v1.4.0? I'm still learning some of this history of this tag so I'd just like to know if it fits for v 1.x or v2.

sembler commented 3 years ago

After reviewing the commit history, yes we should do this before the next release. Returning those tags to being generated fixes a lot of troubles for us.

sembler commented 3 years ago

@obecker did you plan on creating a PR for this, or should I work on it?

obecker commented 3 years ago

@sembler Here you are!

Fun fact: the manual body tag missed a lot of onsomeevent attributes. Now with the generated code, this has been fixed as well.