WebReflection / WebReflection/linkedom
HTMLTemplateElement toString does not include contents
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.1k
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
I see that this related issue is marked as closed https://github.com/WebReflection/linkedom/issues/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>'
)
},
},
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at esm/html/template-element.js around line 19, where HTMLTemplateElement.toString is defined. Compare its output with the behavior described in the issue and the provided local workaround. Done means toString includes the template contents before the closing tag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100