Skip to content

Conversation

@ThomasWaldmann
Copy link
Member

@ThomasWaldmann ThomasWaldmann commented Jan 23, 2026

No description provided.

problem:

before this fix, gen.tag('br') did output '<br></br>', which is invalid and should be either '<br />' for xhtml or '<br>' for html5.

this was the case for most void elements.

the old code could easily lead to invalid markup, if the dangle and paired (empty_in_html and always_paired) arguments were not given correctly and the defaults happened to be wrong for the specific element.

fix:

use a set of known html5 void elements (it is reasonable to use the same list also for xhtml generation, the alternative would be worse).

if an element is not in that set, it is a container element.

API: we now reject to call Tag.open or Tag.close methods for void elements, these should be created by gen.tagname(...), which will either create a self-closing tag for xhtml or a dangling tag for html5.
@ThomasWaldmann ThomasWaldmann merged commit 59ea80d into discorporate:master Jan 24, 2026
5 checks passed
@ThomasWaldmann ThomasWaldmann deleted the fix-markup-generation branch January 24, 2026 16:07
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.

1 participant