handlebars-lang / handlebars.js

Minimal templating on steroids.
http://handlebarsjs.com
MIT License
17.96k stars 2.04k forks source link

How to output [object HTMLDivElement]? #1910

Closed blaasvaer closed 1 year ago

blaasvaer commented 1 year ago

A property on my data object is a DOM Element ([object HTMLDivElement] and don't ask me why), and I can't for the life of me figure out HOW to actually add it to the DOM from within a Handlebars template, anyone have ANY idea how to do this?

I've tried with a helper, but cannot figure out what to turn it into and what to return … hmm.

blaasvaer commented 1 year ago

And – as always – the split second I post I find the answer myself:

return new Handlebars.SafeString( DOMElement.outerHTML );