HTMLTemplateElement toString does not include contents
saviski opened this issue · comments
linkedom/esm/html/template-element.js
Line 19 in ec5ce84
I see that this related issue is marked as closed #21
But later modifications removed this functionality
I am using this hack locally to get the functionality I need
const originaltoString = Object.getOwnPropertyDescriptor(Element.prototype, 'toString')!
Object.defineProperties(HTMLTemplateElement.prototype, {
toString: {
value() {
return (
originaltoString.value
.call(this)
.replace(/<\/template>$/, this.content.childNodes.join('')) + '</template>'
)
},
},
})
the test works though ... I am not sure when/where/how you are having issues ... can you share a minimal broken example code instead of your fix? thanks!