Forum How do I...?

Self-closing tags behaving like opening tags

Occasionally our html contains an element which, because it had no content, after some js transforms, has self-closing tags: eg
<h1 class="title" />
It seems that maybe Prince is treating the above as an opening tag only? For example, with the above tag, everything following that element in the output pdf had the h1.title style applied.

Is this an expected behavior? Or something with our implementation?

(using Prince version 11.4)

I don't think HTML supports empty h1 tags, so this will only work if your input document is XML and is being processed with -i xml on the command line.
Hi, what exactly do you mean by "js transforms"? Do you use a serializer that outputs XML (or XHTML)? If you do, it should be fairly save to tell Prince the input is xml.

Announcement: repos for tests/utils

Thank you both for responding. Re: js transforms we're using node with cheerio; and it does look like a couple of the transforms were using xmlMode=true, which resulted in the above tags as well creating an occasional <span /> tag which has also caused issues.
I'll experiment with prince - xml flag versus just changing our transforms.
Thanks again!