For user-facing code, I would absolutely agree that handling DocumentFragments is the safer (and sometimes more useful) option.
However, producing raw HTML is excellent for things like email template generation. With HTML emails, you're always working with a lot of constraints due to the wildly varying support in client capabilities. A lot of the HTML you end up generating is in fact invalid by any modern spec. Opinionated templating frameworks are often less-than-useful here, and even more often just too big for the intended purpose. Rolling your own is, imo, an excellent way to solve that.
For user-facing code, I would absolutely agree that handling DocumentFragments is the safer (and sometimes more useful) option.
However, producing raw HTML is excellent for things like email template generation. With HTML emails, you're always working with a lot of constraints due to the wildly varying support in client capabilities. A lot of the HTML you end up generating is in fact invalid by any modern spec. Opinionated templating frameworks are often less-than-useful here, and even more often just too big for the intended purpose. Rolling your own is, imo, an excellent way to solve that.
Honestly speaking, I didn't know much about templating HTML prior to this blog post but now I know! Thanks! I will keep exploring!