diff --git a/cjs/html/text-element.js b/cjs/html/text-element.js index d55b5d3c..2dfe704c 100644 --- a/cjs/html/text-element.js +++ b/cjs/html/text-element.js @@ -10,7 +10,11 @@ class TextElement extends HTMLElement { toString() { const outerHTML = toString.call(this.cloneNode()); - return outerHTML.replace('><', () => `>${this.textContent}<`); + /* c8 ignore next */ + if (outerHTML.endsWith(' />')) return outerHTML; // self-closed, as in XML documents + // the text goes before the end tag, as attribute values can contain "><', () => `>${this.textContent}<`); + /* c8 ignore next */ + if (outerHTML.endsWith(' />')) return outerHTML; // self-closed, as in XML documents + // the text goes before the end tag, as attribute values can contain "><', () => `>${this.textContent}<`); + /* c8 ignore next */ + if (outerHTML.endsWith(' />')) return outerHTML; // self-closed, as in XML documents + // the text goes before the end tag, as attribute values can contain ">