tipsy / j2html

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

Fix implementation flaw that called render() during tree construction #182

Closed obecker closed 3 years ago

obecker commented 3 years ago
obecker commented 3 years ago

Hi @sembler, I noticed that there is code in j2html that calls render() when constructing the HTML tree. Two of these findings (using each) have been fixed in this pull request. The existing tests for these methods are still returning the expected rendered HTML text. I refrained from adding new tests that would have created wrong formatted HTML.

Note, there is still the (recently updated) DomContentJoiner class that also calls render(). Fixing this code cannot be easily done as there is also some string replacement involved that removes unwanted spaces before commas and dots. However, since this method is returning text (and not DomContent), this behavior might be OK as same "very special purpose" method.